Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET on .NET 4 causing IE11 throw _doPostBack is undefined javascript error

Edit: The site is on Windows Server 2003, hence cannot be upgraded to .NET framework 4.5.

Our web site is serving ASP.NET ON .NET 4. When using IE 11 the auto postback stopped working with the error "_doPostBack is undefined". It's very likely can be fixed with some modification to the browser definition file, which I don't know how yet.

Microsoft suggests feature detection (preferred), or changing the browser definition file. http://msdn.microsoft.com/en-us/library/IE/hh869299%28v=vs.85%29.aspx

It looks like feature detection means dropping auto postback all together. Isn't that just like rewriting the whole site?

Can someone describe how to accomplish both feature detection and browser definition file modification? Which way is preferred and why.

The accepted answer solved the problem, seems like it's the only way if you are stuck on server 2003. It would be really really nice if someone could explain how feature detection could be done without massive code changes.

like image 941
frogcoder Avatar asked Nov 05 '13 07:11

frogcoder


4 Answers

It seems that Windows Server 2003 needs a server-wide solution and all hotfixes didn't work, so it must be done manually.

  1. Edit C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Config\Browsers and add the browser definition in this answer https://stackoverflow.com/a/19203518/1297563
  2. Run c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regbrowsers.exe -i
  3. Restart IIS
like image 164
Jiayun Zhou Avatar answered Sep 29 '22 11:09

Jiayun Zhou


Upgrade your .NET Framework to 4.5

Once installed run the command:

aspnet_regbrowsers -i
like image 45
Karl Glennon Avatar answered Sep 29 '22 12:09

Karl Glennon


@FrogCoder

I came across this problem yesterday - and the patch 2836939 solved my issue. Windows 8.1 IE11.

Please consider the following from the Hotfix URL:

"Note If you run the ASP.NET browser registration tool (Aspnet_regbrowsers.exe) after you install the update, the old behavior will return."

http://support.microsoft.com/kb/2836939

Hope this helps.

like image 23
TryingToCode Avatar answered Sep 29 '22 11:09

TryingToCode


Place below script in your master page will fix it. i had a similar issue and got fixed.

<script runat="server">

protected override void OnInit(EventArgs e)
{
Page.ClientTarget = "uplevel";
base.OnInit(e);

}
</script> 
like image 39
vishal Avatar answered Sep 29 '22 13:09

vishal