We are getting some strange behavior on our site after upgrading the product to .NET 4.5. I will try to be as specific as possible but the problem is vague, so please bear with me. Also, for this scenario, work under the assumption that no best practices have been followed.
The user is coming to a page that makes a number of jquery ajax calls, asynchronously, to a webservice. Because of the poor design/coding on this page, it can take forever to load, but it does provide a sub menu that the user needs access to. Once the page begins to load, they click one of the menu options to go to another page. Nothing too special so far.
When we use perfmon on a box with .NET 4.0 only installed, we can see the ASP.NET Requests go up and down, as you would expect:
When we install it on a box with .NET 4.5 installed we get this:
After executing the workflow I described above, the request get hung up. Not queued; they just sit there.
After further research, we are noticing that the clicking between the two different pages is not just a simple href, but is actually using Response.Redirect(url);
Also, this is only happening when using IE. This is not an issue when using Firefox and Chrome.
Here is what we have tried so far:
Also as requested, here is the HttpHandler code:
public class KeepSessionAliveHttpHandler : IHttpHandler, IRequiresSessionState
{
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
if (context.Session.IsNewSession)
{
string redirectUrl = context.Request.Url.AbsoluteUri.Replace(context.Request.Url.AbsolutePath, VirtualPathUtility.ToAbsolute(Constant.Page_Logout));
context.Response.Clear();
context.Response.ContentType = "application/json; charset=utf-8";
context.Response.Flush();
context.Response.Write("{\"IsSessionAlive\": \"false\", \"RedirectUrl\": \"" + redirectUrl + "\"}");
}
else
{
context.Session["KeepSessionAlive"] = TimeZoneHelper.GetCurrentUtcDateTime();
context.Response.Clear();
context.Response.ContentType = "application/json; charset=utf-8";
context.Response.Flush();
context.Response.Write("{\"IsSessionAlive\": \"true\"}");
}
}
}
Any suggestions on where we should look next?
The following patch has now been released by Microsoft that appears to fix the issue without requiring web.config or IIS configuration changes. http://support.microsoft.com/kb/2828841/en-us http://support.microsoft.com/kb/2828842/en-us
After further investigation and insight/solutions provided by the .NET compatibility team, I am editing this answer.
The solution found at ManagedPipelineHandler for an AJAX POST crashes if an IE9 user navigates away from a page while that call was in progress does seem to be working more reliably for us. This is behavior we were experiencing in IE8-10, and not just 9 however.
I am going to keep the old answer here, as it hopefully may point people in another direction if the first answer is not relevant.
The source ended up being session locking. The AspNetSessionDataBegin and the AspNetSessionDataEnd events should have been a dead giveaway. For anyone that stumbles on this same problem, look to see when and how you are writing to the session. These links also helped.
Replacing ASP.Net's session entirely
I just discovered why all ASP.Net websites are slow, and I am trying to work out what to do about it
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With