Partager via


Getting 'Webform_Postbackoptions is undefined’ errors in ASP.NET 2.0

Issue

====

I recently got an issue where customer ASP.NET 2.0 website on IIS and on one of the aspx pages he was using RangeValidator control. Browsing to that aspx page was giving client side Java script errors ‘Webform_Postbackoptions is undefined’. Without RangeValidator application was just working fine.

Cause

====

WebResources.axd was not getting downloaded to ‘Temporary Internet Files’ folder. Fiddler showed 500 Status forthe WebResources.axd. IIS Logs showed nothing in my case. When directly browsed to this file it gave errors in one of the events called AcquireRequestState in Global.asax file sitting under App_Code directory. Error was related to session state because an AXD file doesn’t have any session state handler associated.

Resolution

=======

Commented out AcquireRequestState event and now webresources.axd is successfully downloading in ‘Temporary Internet Files’ folder.

Note:- Fiddler tool can be downloaded from https://www.fiddlertool.com/dl/FiddlerSetup.exe. It's a great tool to troubleshoot client side issues.

Comments

  • Anonymous
    February 08, 2006
    Hi Parag

    Thanks for this help.

    I did have same problem, I hope I will get solution fromt this tool.

    Thanks again.

    Raj Gohil
  • Anonymous
    February 14, 2006
    I am glad somebody has addressed this issue. If I comment out AcquireRequestState the javascript error goes away, but when I uncomment the event it continues to be broken. Obviously this will not work for me because I need that event. Do you have any idea how to resolve this issue? Any help would be appreciated.
  • Anonymous
    March 01, 2006
    Hi, this may help to answer your issue:

    http://www.ben-rush.net/blog/PermaLink,guid,2fe91872-e782-4a8d-9085-fe8a01723bcc.aspx
  • Anonymous
    March 02, 2006
    In which file and where I could find it.
  • Anonymous
    April 02, 2006
    http://www.ben-rush.net/blog/PermaLink,guid,2fe91872-e782-4a8d-9085-fe8a01723bcc.aspx  helps quite a lot and Parag thanks for listing the bug
  • Anonymous
    April 16, 2006
    You may solve this problem by execluding HttpHandler from processing AcquireRequestState as follows:

       protected void Application_AcquireRequestState(object sender,
           EventArgs e)
       {
           // Use regular expressions to
           // extract file name from file path.
           string sFileName = Regex.Replace(Request.FilePath,
                                    @"./(.)", "$1").ToLower();

           // Only access session object if the
           // file is not an HttpHandler
           if (!sFileName.Contains(".axd"))
           {
               // Here, you can access Session variables safely
               Session["Whatever_variable"] = "any_value";
           }
       }

    Hope this clarifies the idea.

    Suwaiyan

  • Anonymous
    July 10, 2006
    Hi Parag,

    I don't have AcquireRequestState event in my Global.asax page. Could you please help me on this issue. I am also getting same issue in my Login Screen.

    Mayank
  • Anonymous
    July 11, 2006
    When you open your Global.asax, look at the top of the text editor, you will find a drop down list with some options in it. Select Application option. Then notice that the other drop down list (which is next to first one) contains all possible events which you may create. Just select Application_AcquireRequestState event, and the editor will automatically generate the menthod and signature for you. Rest is copying the code above.

  • Anonymous
    July 11, 2006
    It could be possible that webresource.axd file is not getting downloaded on the client. Try installing fiddler (http://www.fiddlertool.com/dl/FiddlerSetup.exe) on the client and check the status for webresource.axd file.
  • Anonymous
    July 13, 2006
    Our "not downloading" of that file was in the global.asax, but it was in the code example below. In the Application_PreRequestHandlerExecute we were using sessions, but we had to add the if() to see if Session itself was null. If it is, then "return;"

    Works like a charm :)

    -------------------------------------

    protected void Application_PreRequestHandlerExecute(Object sender, EventArgs e)
    {
     if(HttpContext.Current.Session == null)
     {
       return;
     }
     else
     {
       ///  OUR CODE IN HERE
     }
  • Anonymous
    July 27, 2006
    Thank you.  Your solution gave me a hint as to the source of my problem.  I also could not receive the WebResource.axd file when requesting it from the web server, but I received the familiar "Server Application Unavailable" message.  We use a custom HttpHandler and a unique file extension in our application, and this extension was the only one mapped to ASP.NET 2.0.  The others were mapped to the ASP.NET 1.1 ISAPI DLL, which causes the above error in IIS 6.0 because it cannot load two version of .NET in the same application pool.
  • Anonymous
    July 27, 2006
    You are correct. asp.net 1.1 & 2.0 applications should not run under same application pool. For more information please visit,

    PRB: "HTTP/1.1 500 Internal Server Error" Error Message When You Have Multiple ASP.NET Applications That Use the Same Application Pool with Different Script-Mapped Versions
    http://support.microsoft.com/?id=822319
  • Anonymous
    June 09, 2007
    So far... I have seen several different cause and effect's for this:
  • One article mentions the aspnet_client missing, with steps to run the aspnet_reg with the -c option.  This option seems to have worked for many.
  • Another article (linked here) recommends to delete the browser cache and try again.  This seems to have worked for some.
  • Another article discusses older framework versions used by referenced .dll's could be causing the problem (server side) and preventing the creation of the WebResources.axd file
  • Another article discusses where a "null" session variable which is expected during processing of the global.asax file causes and error and (similarly), prevents the Webresource.axd file from being created. I can find many articles about it, or at least regarding the topic, but nothing concrete or thorough enough to fully explain the root cause, how to resolve it, and how to prevent it....  perhaps I am using the incorrect search string to hunt for the answer.
  • Anonymous
    November 22, 2010
    Hi, My problem gets solved........ Just change the server date to Next month date, Close IE (Internet Explorer), Restart IIS and check the error page. .. again i set current date and continue to work.