ASP.Net MVC: ASP.NET application giving JavaScript error "_doPostBack is undefined" in IE10.
Introduction
Sometime you will get Javascript error on Production server that "_doPostBack is undefined" erro in IE10.
Background
Actually every .net build contains definition for application to run on particular browser. but sometime if you system doesn't have latest fixes installed you will get some issues. like above in IE10. It will not come for every application. This will come in the application where you have a <asp:linkbutton> and it requires Javascript to postback. There come the error in IE10. It will run fine in IE9. I searched lot about this and found a really good article from Scott Hanselman's blog about this, from where i got the solution and sharing it to all who are facing this issue. here is the extract from the blog that resolved my issue.
Using the code
To resolve this you have 2 kind of solution.
#1. Machine wide
For this fix there is hotfix by microsoft that will update those and resolve the error for all application. The fixes solve the browser-detection issue forever for all sites on a machine. These will be rolled up into future versions of the framework and will eventually also be on Windows Update.
- .NET 4 - http://support.microsoft.com/kb/2600088
- .NET 2.0
- http://support.microsoft.com/kb/2600100 for Win7 SP1/Windows Server 2008 R2 SP1, Windows Vista/Server 2008, Windows XP/Server 2003
- http://support.microsoft.com/kb/2608565 for Win7/Windows Server 2008 R2 RTM
What the fixes do is update the ie.browser and firefox.browser files in \Windows\Microsoft.NET\Framework\<version>\Config\Browsers with new and future-proofed versions of these browser definitions. Nothing else is affected.
#2. Application wide
If you don't have access to the whole machine and/or just want to update a single project, use NuGet to install the App_BrowsersUpdate package. Your site structure in Solution Explorer will then look like the image at right. Note that NuGet uses .NET 4, so for systems that have only .NET 2, you'll need to get the ZIP file and put the new browser files in App_Browsers manually.
- .NET 4 Browser Update NuGet Package - http://nuget.org/List/Packages/App_BrowsersUpdate
- install-package App_BrowsersUpdate
- .NET 2.0 Browser Update NuGet Package - http://nuget.org/List/Packages/App_BrowsersUpdate.net20
- install-package App_BrowsersUpdate.net20
- Note that NuGet is VS2010 specific so if you don't have nuget.exe and .NET 4, you can also copy the .NET 2 updated browser files into ~\App_Browsers manually from this zip file.
Updating the whole machine is the preferred way to fix this.
Comments
Post a Comment