Wednesday, December 10, 2008

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

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 actually we are using Validatorcontrol on this page. Browsing to that aspx page was giving client side Java script errors ‘Webform_Postbackoptions is undefined’.
In our case there is problem for the linkbutton event that is not working.
http://pocketnerd.blogspot.com/2008/01/webformpostbackoptions-is-undefined.html
Cause
1.WebResources.axd was not getting downloaded to ‘Temporary Internet Files’ folder.
2.Main Cause behind it:The main cause behind this is the porting from asp.net 1.1 to asp.net 2.0.
3.Unavailability of the .axd extention in the IIS where your website is deployed.
Resolution
Step1:Check for the .axd extention in the IIS.
1.Go to IIS.
2.Right click choose property and the Home peoperty
3.Choose configuration
4.Check for the .axd extention. If does not exist the add it.
5.By clicking on the ADD button
6.Add the dll reference from the path of your system
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
7.limit to text box should have: GET,HEAD,POST,DEBUG
8.And uncheck the check box of the option "Verify that file exist" and click on the
OK and apply.
If your problem has not been resolved yet the follow the second step
2.Now you have to copy the .axd file content.For this step you have to first DEBUG the Java script of your page and you will get the .axd content
I just renamed my WebResource.axd file or copy its content to YourFormName.js file and place this file as part of my project(root) and included this file in those pages which are giving problem. I included this file by simple tag. script language="" src="...." tag. in head section.

After this at least your link button event will work properly, but you may still get the syntax error.This was not the permanent solution.
If Still you are facing the problem then follow next step

3.If your project is converted from asp.net 1.1 to asp.net 2.0 then, Just simply
remove old page and add new page (with same code and then remove the validator that
is used(any type) and place then again in asp.net 2.0.
and run the project, your project will work properly and link button event will fire
properly.

No comments:

Post a Comment