ASP.NET AJAX Funky Exceptions Part II

by Ted Jardine Friday, October 05, 2007 12:40 PM

Back in the summer I described an issue with ASP.NET AJAX. The session solution dealt with things well enough (and note the update to simply disable session in a page-by-page basis for all but the pages requiring reading or writing to the session), but I'm still getting the occasional SystemWeb.HttpException where there's a problem with the RoleManager module:

Server cannot modify cookies after HTTP headers have been sent.

Stack trace: at System.Web.HttpCookieCollection.Add(HttpCookie cookie) at System.Web.Security.RoleManagerModule.OnLeave(Object source, EventArgs eventArgs)

Of course, because the user doesn't get what's going on (the user just gets the javascript alert box mentioned previously as I haven't intercepted the ASP.NET AJAX thrown error in this application - for this reason, I will be in all future applications), this exception is usually thrown multiple times until the user navigates to another page and then returns to try again. Some users are quite persistent (I recall one being close to 10 times) which would be humorous if it wasn't just so cruel and bad.

It turns out I've had to disable role caching as per the article I mentioned in the last post until either the ASP.NET Role Manager is fixed or I decide to write/find a custom role module. What's interesting is that the roles are not ever being changed in the pages throwing the exception! Harumph. Back to looking at jQuery from here on in.

Has anyone come up with a solution for this so that the roles data store is not being hit on every page load?

UPDATE: As per the comments below, apparently this has been fixed in ASP.NET 3.5, but there are no plans to back port the fix to 2.0.

 

blog comments powered by Disqus

Month List