Link to home
Start Free TrialLog in
Avatar of ideamatics
ideamatics

asked on

WebForm_PostBackOptions is undefined

Hello,

I recently deployed my application to our server and have been receiveing the “WebForm_PostBackOptions is undefined” error on several pages (after a button is clicked).  I’ve done hours of research on this issue and have tried many of the suggestions to fix this error.  

First, let me give you a little information about my application:

•      The app was recently converted to ASP.NET 2.0
•      On the server, it uses a new application pool for asp 2.0
•      Includes several 3rd party controls (RADControls, Intersoft WebGrid and WebCombo)
•      Runs fine on my local machine
•      Error usually occurs when a button is clicked.  The page will still perform the operation, but a javascript error will be displayed before the page reloads.  
•      My server is running Windows Server 2003 and using IIS 6.0.  
•      The Application is under a domain with an SSL certificate.
•      We have another 2.0 application (built from scratch, not converted) running flawlessly on the same server.  
•      The ASP.Net property for the virtual directory in IIS is set to use 2.0.
•      For deployment, I compiled the project locally and pushed the files to the server.  

I think the problem is with the WebResources.axd file.  For some reason, the application cannot extract the needed scripts from it.  I took someone’s suggestion of viewing the source for a page, locating a call to the WebResources.axd file, copying the link, and pasting in a browser window.  This should return the requested script, however I get an error message: “Session state is not available in this context.”  I’m also a little confused about where the WebResources.axd file is located.  Does anyone know where it is? Is it embedded in a dll?  Should it be in the root directory?

It should be noted that the RADControls were not working correctly at first.  By default, they try and access the WebResources.axd file.  I had to insert UseEmbeddedScripts=”false” in every control declaration, which forces them to use the scripts contained in the RADControls folder.  This fixed the problem.

I’ve also done the following to try and fix the errors.  
•      in IIS, opened the properties for the virtual directory, clicked configuration, and verified that the .axd extension was mapped to c:\windows\microsoft.net\framework\v2.0.50727\aspnet_isapi.dll.  I also verified that the checkbox was unchecked for “Verify if file exists”.  
•      Verified that the asp.net 2.0 installation was installed correctly.  Like I mentioned above, we have another 2.0 application that runs flawlessly.  

I came across a couple cases where this error message was fixed by including the WebForms.js file in the root directory and adding a reference to it on all pages.  I have not tried this because I don’t exactly know how to get this WebForms.js file.  I’ve searched my computer for it with no luck.  I read that it is included in the System.Web dll, but I’m unsure as to how to extract this.  Does anyone know how to do this?  

Does anyone know of any other solution or suggestions to fix this javascript error?  

Thank you in advance for your help.
Avatar of Sammy
Sammy
Flag of Canada image

have you tried another project with just a test page?
try that on the same server and see if it works then you may a problem with the custom controls you have. if the test doesnt work you will have to re install asp.net 2.0 on the server.

Good luck
Avatar of ideamatics
ideamatics

ASKER

Hi Sammy,

I don't believe that the controls are to blame.  There are many pages that include the RADControls where the WebForm_PostBackOptions error is not displayed on button clicks.  Also, this error appears on other pages that do not use the RADControls at all.  

I also don't think that the ASP.Net 2.0 reinstallation will fix the problem.  We already have a .NET 2.0 application running flawlessly on the server (also uses RADControls). However, It should be noted that that application is in another application pool and uses a different SSL certificate.  Do you still suggest a reinstall of 2.0?
Just to understand this better, you have some pages within the same application using the same application pool that run fine with any error?
The only thing I can think of is the your WebResource.axd is not being served over SSL
try this
delete all files in "You may have to restart you app to do so"
C:\WINDOWS\Microsoft.NET\Framework\Version Number\Temporary ASP.NET Files
Clear your temp files

Hi Sammy,

Yes you are correct.  Some of my pages work without a problem.  I restarted my webserver and cleared the temporary asp.net files.  I also cleared my local temporary internet files.  Still no luck. The error remains.  I checked my temp files and noticed that the WebResources.axd file is not there.  So you could be correct in that the WebResource.axd file is not being served over SSL.  

Any idea on how to fix this? Any idea on how to extract the WebForms.js from System.Web?  Thanks!
I took a look at the two pages.  The first one was pretty interesting, although i don't see how it is applicable to my issue.  I read the paragraph at the bottom that talked about the webresource.axd file...however it told the reader how to set a property so the application ignores webresources.axd.  It seems that there is a communication problem between the application and the webresources.axd file.  I'm note even sure if this file is being generated as it is not in my temporary internet files.

I also thought the second page was interesting, and i learned a few things from it.   Unfortunately, the debug is already set to false in my webconfig.  

Thanks for the suggestions. Any more ideas???
ASKER CERTIFIED SOLUTION
Avatar of Sammy
Sammy
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ouch! All of my images were broken, all 3rd party controls did not display/function properly, and the WebForms_PostBackOptions error still remains.  
Ok I found a solution to my problem.  My initial assessment was correct in that I needed to directly reference the WebForms.js file on all of my pages.  The problem was that I could not find instructions on where the WebForms.js file was or how to extract it.  The process is as follows:  Navigate to C:\WINDOWS\Microsoft.NET\Framework\v2.0....
Open the System.Web.dll file using notepad.  The first part of the file will all be special characters.  Scroll down until you see javascript.  Copy all of the javascipt there (be sure to include the first function listed, which is WebForm_PostBackOptions) and paste into a text document.  save the text document as WebForms.js.  You might have to comb through the javascript and delete any special characters.  I deleted about 5-10.  Next, place the WebForms.js file in the root directory of your application and include this file in all of your pages by placing "<script src="WebForms.js" type="text/JavaScript"></script>" in the <HEAD> of your page.  That's it! The error was fixed.  This is a workaround and i'm still curious as to what is causing the error.  I know that it all goes back to the WebResources.axd file.  If anyone has any ideas, please let me know.  

Also, thanks Sammy1971 for your help!
Did you look on the server to see if anything was preventing the .axd extension from being served?  

We had this problem on our web farm recently, and in IIS 6.0 the extension .axd for the web application had the "Verify File Exists" button checked.  However, WebResources.axd is being served from a temporary location (directly to the client browser cache) and therefor seemed to not exist, and was then ignored.  Unchecking "Verify File Exists" eliminated the problem.

We also had cases where SiteMinder was being used for Authentication. The SiteMinder WebAgent ISAPI filter (in IIS) was mapped to * extensions with the "Verify File Exists" button clicked... again, in these cases, removing the "Verify File Exists" resolved the problem.

Here's a problem with the solution you chose - what if there is an update to .NET Framework 2.0, or if some later generation of .NET Framework alters the client-side scripts?  You will then have to update the webforms.js file... blech.

You perhaps could have also tried the following:
a)      Aquire WebResource.axd (you can usually find this in Internet Explorer Temporary Internet Files), otherwise - search the web via Google for this file and it is availabe here and there.  If you take a look at this article, it also explains how to retrieve it: http://support.microsoft.com/kb/931762/
b)      Then, the following must be done on each server *blech*
c)       Using IIS Management Console, go to the Application Configuration application by selecting home directory tab for the web site (if this is a virtual on a Shared Web Site, then choose the virtual so this change is applied at the virtual level and not the entire web site), then clicking Configuration button.
d)      The 1st tab for Application Configuration will be the Mappings tab
e)      View the Executable Path and Verbs used for .aspx
a.      Executable Path is likely:  C:\WINNT\Micorosoft.NET\framework\framework\v2.0.50727\aspnet_isapi.dll  (please verify)
b.      Verbs:  Limit To:  GET, HEAD, POST, DEBUG (please verify)
c.      Check Enabled for: Script Engine  (please verify)
f)      Add a mapping for the .AXD extension pointing to the exact .DLL and which is mapped to the .aspx
a.      Extension:  .axd
b.      Executable Path is likely:  C:\WINNT\Micorosoft.NET\framework\framework\v2.0.50727\aspnet_isapi.dll
c.      Verbs:  Limit To:  GET, HEAD, POST, DEBUG
d.      Check Enabled for: Script Engine
e)                  UNCHECK THE BOX FOR VERIFY FILE EXISTS
g)      Click OK.
h)      When prompted, do not choose to apply the app mapping change to all of the other virtuals.
i)      Repeat above steps on each server in this farm.

Rich
Sorry - append these steps to a) in my post above, to Copy the WebResource.axd file to the root folder of your website... on the page you receive the error, you can view source, and search for WebResource.axd, it should show you which folder or virtual to place the file...