ASP.NET AJAX 1.0 RTM Bug

For a few days, I'm doing some QA and testing at work of a web application that some of my companions have been developing.

The application has typical technologies (SQL Server 2005, ASP.NET 2.0, a bit of Active Directory, master pages, ...) and it also uses ASP.NET AJAX. The entire website was built with the early versions, porting to beta and now running with the 1.0 RTM.

All was going well until the RTM upgrade (made few weeks ago). The app. started to throw some exceptions from time to time, but they thought it was because of the development server (an old laptop which stores a Virtual Machine with the "real" DB and web server). When I joined to do the QA and testing, I started to get the errors almost every few minutes, making the application crash frecuently.

The exception we got was this:

Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server.
The status code returned from the server was: 12029

As the official documentation for the error is crappy, we searched and searched until we found the solution.

Seems that there's a bug in the RTM version of ASP.NET AJAX (not present in earlier versions) with the RoleManagerModule when it adds its cookie to Response's cookies.

There are 3 ways to evade the bug. None is perfect but the first one worked well for us and required no code rewriting:

  1. Disable caching of cookies in the RoleManager.
    <roleManager enabled="true" cacheRolesInCookie="false">
  2. Handle the Application's Error event to clear the error from the Context selectively.
    void Application_Error(object sender, EventArgs e)
    {
    //There should be some checking done so that not all the errors
    //are cleared
    Context.ClearError()
    ;
    }

  3. Disable EventValidation in the web form.
    <%@ Page Language="C#" EnableEventValidation="false" %>

Hope helps someone else if they have the same problem

Comments?

Posted by Kartones on 2007-02-26