Dear experts,

I have a javascript function that is called on tab change of a tab container. From that javascript function, I call a simple page method. But though the page method does everything correctly, a failure is reported.
Here is my code:
function JSSetMarketingActiveTabIndexSession(sender, args) {
if (sender != null) {
PageMethods.SetSessionVariable("MarketingActiveTabIndex", sender.get_activeTabIndex(), OnSucceeded, OnFailed);
}
}

[System.Web.Services.WebMethod]
public static void SetSessionVariable(string sessionVariableName, object value)
{
HttpContext.Current.Session[sessionVariableName] = value;
}

When I place breakpoints in the page method and in the OnFailed function, the execution stops in both of them almost at the same time, so an exception is caught even before the page method has done anything.
Could you please help me on this?
Thanks.