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.
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.  
Updating the whole machine is the preferred way to fix this. 

Comments

Popular posts from this blog

LINQ: Using int.TryParse() within a LINQ where clause

ASP.Net MVC: Configuring asp.net session state in SQL Server.

IIS: Publish Project to remote IIS with Web Deploy.