IE10 and IE11 and Windows 8.1 and __doPostBack
A while back there was a bug in the old browser definition files that shipped with .NET 2 and .NET 4. Fast forward to today and these older ASP.NET’s will mis-detect IE10 and IE11. If you have this, you'll see __doPostBack JavaScript errors in your sites when IE10 or IE11 hit them.
- This whole concept has been long-fixed in ASP.NET 4.5. If you have a .NET 4 app you put .NET 4.5 on it and you're set. We don't sniff like this anymore.
- Two years ago there was a backward-fix to all versions of ASP.NET on all OSs including .NET 2, 3, and 4.
However, I'm still getting email from folks who are seeing this, which means they've got very unpatched installations.
Aside: If you don't have this two year old patch, be sure to check out what other updates your server is missing. Again, rollups like .NET 4.5 and "hotfix rollups" get you the latest in one swoop.
Here’s all the internal details for this fix across every combo of framework and OS if you can’t get .NET 4.5. You may want to run "aspnet_regbrowsers -i" after installing the fix if you're having trouble.
- 2836939 .NET 4 - Win7SP1/Win2K3SP2/Win2K8R2SP1/Win2K8SP2/VistaSP2/WinXPSP3
- 2836940 .NET 3.5 SP1 - Win2K3SP2/Win2K8SP2/VistaSP2/WinXPSP3
- 2836941 .NET 2.0 SP2 - Win2K3SP2/WinXPSP3
- 2836942 .NET 3.5 SP1 - Win7SP1/Win2K8R2SP1
- 2836943 .NET 2.0 SP2 - Win7SP1/Win2K8R2SP1
- 2836945 .NET 2.0 SP2 - Win2K8SP2/VistaSP2
- 2836946 .NET 2.0 SP2 - Win8RTM/WinRTRTM/Win2K12RTM
- 2836947 .NET 3.5 SP1 - Win8RTM/WinRTRTM/Win2K12RTM
You really shouldn’t be "sniffing" browsers, you should check for the existence of features in your browser. There have been a number "mobile browser" files, including one I used 4 years ago.
If you are using a custom browser definition file (and perhaps forgotten about it) you may STILL see a problem with IE10 or IE11 because you've got your own overriding custom browser sniffing regexes in there. Either remove the need for a browser definition file (ideal) or open up your custom file and remote the IE portion.
TL;DR Version
- DO - Keep your Web Servers patched.
- DO - Upgrade to ASP.NET 4.5 if you can.
- DON'T - Use old Custom Browser Definition Files from years ago and expect them to work
- DO - Get newer files from http://51degrees.mobi
- DO - (Last resort) Edit your custom files to remove IE
Hope this helps.
Sponsor: Thanks to Red Gate for sponsoring the feed this week! Check out a simpler way to deploy with Red Gate’s Deployment Manager. It can deploy your .NET apps, services, and databases in a single, repeatable process. Get your free Starter edition now.
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
http://msdn.microsoft.com/en-us/library/5a4x27ek.aspx
My codebase is riddled with browser detection, and it's nearly all needed to work round specific bugs in specific versions of specific browsers (mostly IE of course). And this isn't all about legacy browsers, the most recent was an IE10 bug.
In this case, it's far clearer and more obvious in the code to use browser detection.
UpdatePanel render sync formatted response for async PostBacks when IE 10 is used as client.
I wrote this issue to Microsoft Connect. (IE 10 & UpdatePanel incompatibility over .NET 4.5)
They are investigating now.
I uploaded a simple web application there, to show that situation.
I also wrote that to ASP.NET AJAX Forum on official ASP.NET website twice, but they very kindly remove that each time!!!
It is tough to sell software in Uganda if we also have to get the customer to pay for licensing too. Cloud services would be great for me but unfortunately Azure is not available officially in Uganda like it is in Kenya (JUST NEXT DOOR!!).
Forgive the rant.
- As a web developer I truly hate IE, I think it should be globally boycotted and eliminated, because I had wasted a lot of time fixing IE bugs (css or js). Every IE version is 'special'. Who wants to maintain a ton of IE versions one worse than other?
- My start-up website will not support IE, in IE I'll just display a message: "This browser is not supported, for best user experience please use a modern browser".
- Usability: what sane browser would ask my grandma' if she wants to use accelerators or other shit?
- I wonder if programmers who develop IE are using IE for their personal browsing. I bet they don't - I mean they must be senior devs and they are hired by Microsoft, so, contrary to popular belief, they must have some brain.
Truly IE hater.
I use Firefox and Chrome for testing. Personally, I don't like Chrome because Google's habit of harvesting user information, profiling them and selling it to highest bidders.
It is pretty easy to avoid most issues between versions. Use a CSS framework and use jQuery, because they have done already done all the hard works of dealing with compatibility.
Just for the record the jQuery team themselves have said that they had to put in less hacks for IE9 & 10 in jQuery 2.x compared to other browsers.
"We don't sniff like this anymore"
Can you link to some doco to indicate how you detect on .NET 4.5
We are have a ~lively~ discussion at work regarding adaptive ( server detect and render ) vs responsive (clientside via media queries and feature detection ).
I've argued that server side detection is an inherently flawed concept and it's best to detect features clientside ( ie via Modenizr ).
Yes, server side is flawed, but can have use in limited scenarios. For example, if a browser supports OGG audio and not MP3, you can serve them the right file.
Thanks to your attentions.
Not only ImageButton, but also every event raiser controls.
I read about ImageButton issue.
That issue relates to __doPostBack problem, this is something else and happens on both .NET 4.0 and 4.5.
In my uploaded sample on Microsoft Connect, I put a DropDownList and GridView inside UpdatePanel.
DropDownList should filter GridView's data on SelectedIndexChanged event.
On default IE Document Mode (IE10 or edge), after changing value of DropDownList, when async PostBack has been raised, returned response format is not MS AJAX Friendly and cause error 0x800a139e.
I think there are some issues in "ASP.NET AJAX Client Library 4.x" when run on IE 10.
(maybe on "browser capabality detection" and "UpdatePanel back-end")
I apologize, I am not good in English.
Moving to .NET 4.5 would be helpful, but the Windows 2003 dependency is an all-too-real one in my organization as well, unfortunately, limiting us to .NET 4. Enterprises can be slow-moving animals, bound by procedures and inefficiencies that can prevent timely upgrades. It's good that 2003 is not far from being end-of-life. A vulnerable, non-supported setup causes security concerns that tend to accelerate migrations.
First, we had to set Page.ClientTarget = "uplevel"; in our base page.
Second, we had to go into web.config and change <authentication><forms> to have cookieless="UseCookies"
Until we did this, Forms authentication and some other features of Asp.Net would not function properly on IE 11.
Systems were properly patched, but only these changes seemed to help.
I understand that Microsoft really wants people to stay up to date on the framework, but sometimes that isn't feasible. Especially with installed web applications that are not hosted in-house, but rather on client systems that we do not control. I agree with Simon. When you have customers that are very large, changing operating systems on servers is a very political endeavor, and can take literally years.
If there is something else we should have done instead of the changes above, I'm all ears. Would really like to know the "right" way to do it.
Unfortunately not all customers have the money (or time for training, IT push back, etc.) to upgrade to new machines all the time, especially when they already spent tons of cash getting their 2003 server up in the fist place - so it is nice that a workaround exists that does not rely on .NET 4.5.
I had similar issue with Internet Explorer 11 not detected correctly by .NET 4.0 framework. I would like to share how I've worked around the problem. Installing the suggested patches haven't done the trick so after digging deeper into the issue I found that although http://support.microsoft.com/kb/2836939 patch is installed on the server the browser still have been recognized as Mozilla with version 0.0 on the server. After additional research I've found that in case you have any .browser file in your site's app_browsers folder, the version detected on the server is wrong, namely Mozilla 0.0. To workaround the issue I created a custom .browser file in the app_browsers directory with the following content:
<browsers>
<browser id="IE11" parentID="Mozilla">
<identification>
<userAgent match="Trident\/7.0; rv:(?'version'(?'major'\d+)(\.(?'minor'\d+)?)(?'letters'\w*))(?'extra'[^)]*)" />
<userAgent nonMatch="IEMobile" />
</identification>
<capture>
<userAgent match="Trident/(?'layoutVersion'\d+)" />
</capture>
<capabilities>
<capability name="browser" value="IE" />
<capability name="layoutEngine" value="Trident" />
<capability name="layoutEngineVersion" value="${layoutVersion}" />
<capability name="extra" value="${extra}" />
<capability name="isColor" value="true" />
<capability name="letters" value="${letters}" />
<capability name="majorversion" value="${major}" />
<capability name="minorversion" value="${minor}" />
<capability name="screenBitDepth" value="8" />
<capability name="type" value="IE${major}" />
<capability name="version" value="${version}" />
</capabilities>
</browser>
<!-- Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11,0) like Gecko -->
<browser id="IE110" parentID="IE11">
<identification>
<capability name="majorversion" match="11" />
</identification>
<capabilities>
<capability name="ecmascriptversion" value="3.0" />
<capability name="jscriptversion" value="5.6" />
<capability name="javascript" value="true" />
<capability name="javascriptversion" value="1.5" />
<capability name="msdomversion" value="${majorversion}.${minorversion}" />
<capability name="w3cdomversion" value="1.0" />
<capability name="ExchangeOmaSupported" value="true" />
<capability name="activexcontrols" value="true" />
<capability name="backgroundsounds" value="true" />
<capability name="cookies" value="true" />
<capability name="frames" value="true" />
<capability name="javaapplets" value="true" />
<capability name="supportsCallback" value="true" />
<capability name="supportsFileUpload" value="true" />
<capability name="supportsMultilineTextBoxDisplay" value="true" />
<capability name="supportsMaintainScrollPositionOnPostback" value="true" />
<capability name="supportsVCard" value="true" />
<capability name="supportsXmlHttp" value="true" />
<capability name="tables" value="true" />
<capability name="supportsAccessKeyAttribute" value="true" />
<capability name="tagwriter" value="System.Web.UI.HtmlTextWriter" />
<capability name="vbscript" value="true" />
</capabilities>
</browser>
</browsers>
Similar approach is suggested on the following article: doPostback failing in IE 11+ Windows 8.1
I would like to clarify that the issue is happening only with .NET 4.0, while with .NET 4.5 the browser and its version are detected correctly.
Best Regards, Mihail
It may have been first released 10 years ago, but SP2 was 2007 (6 years ago).
Not only that, projects that started on or before 2008 were most probably using Server 2003.2. These projects were probably completed in 2009/10 - and we don't change OS half-way through development.
Welcome to the real world.
we want to support .NET 2.0 on Mozilla but could not find Mozilla.browser file in the hotfix. could you please provide the file if missing or guide us on how to modify.
Thanks.
I'm not doing any browser sniffing, but the ASP.NET controls like linkbutton seem to be doing that.
Surely Microsoft could have released a new patch with IE11 in order to get their own browser working with their own web framework?
my bad.
Thanks!
I've been playing with putting a .Net site behind a CloudFront CDN. Turns out that they always rewrite the user-agent to be 'Amazon CloudFront', consequently no post-backs on my site!
Interesting huh...
Thanks for always sharing fruitful tips. My asp.net 4.0 application is heavily using ajax toolkit 4.0. It was completely working till IE10. But now in IE11 it's completely down. Nothing is working under update panel.
So what's the solution?
Thanks
I am trying to get ASP.NET 4 to work properly with Chrome/27.0.1453.94. If I use browser capability detection then it is treated as a down level browser even though I can see all the uplevel settings in Request.Browser.
If I set page.ClientTarget to uplevel then javascript, __dopostback, and css all function correctly but the Request.Browser capabilities show IE settings not Chrome settings.
Is there a way to separate the setting of clientTarget as uplevel from the BrowserCapabilities loaded into Request.Browser object? or perhaps a way to reload Request.Browser afterwards?
Do you have anything to add onto Mihail's post? I am seeing what he is describing. The patch does not work for me and Mihail suggests this can happen if there are other browser files in the App_Browsers folder (this is true).
I do not want to use the custom browser file he has suggested as I would want to use something more permanent. I can upgrade to .Net 4.5, but as my product is installed at over 200 sites, this is a tricky roll out.
Can you confirm if Mihail is correct or whether this is a bug?
thanks,
In regards to non-IE and non-Firfox browsers, the browser detection is working for the simple case but failing when the aspx page is openned from javascript. In the window.open(...) case IE and Firefox are treated as uplevel while Chrome and Safari are treated as downlevel.
They have cause considerable frustration and harm to customers using ASP.Net websites, as well as heaping trouble and scorn on the developers supporting ASP.NET. This is further damaging Microsoft's reputation at a point in the markets (OS, browser, and development tools) when they REALLY can't afford it.
For example, in our product, we had a .browser file for CriOS. Had nothing to do with IE, but the sheer presence of the file caused IE detection to fail under ASP.Net 4.0.
Funny thing is that the same code is running on two different servers. Both with fully patched systems and with the hotfix installed as well. Both were rebooted, had aspnet_regbrowsers -i run, then rebooted again. One system failed when the crios.browser file existed, and one succeeded.
Deleting the app_browsers directory completely solved the problem for us on both machines.
Anyways, maybe this will help someone.
I would like to make a small correction to the regular expression that detects Internet Explorer browser in my previous post. Actually it doesn't match the user agent of IE11 on touch devices so it might be replaced with the following one:
<userAgent match="Trident/(?'layoutVersion'[7-9]|0*[1-9]\d+)(\.\d+)?;(.*;)?\s*rv:(?'version'(?'major'\d+)(\.(?'minor'\d+)))" />
The approach is also described at the following thread:
http://www.telerik.com/community/forums/aspnet-ajax/general-discussions/incorrectly-rendered-webpage-when-using-internet-explorer-11.aspx
Best Regrads,
Mihail
%windir%\Microsoft.NET\Framework\v4.0.30319\Config\Browsers
Alternatly you can add add an ie.Browser file in your web application within the folder App_Browsers with the following entry
<browser id="InternetExplorer" parentID="Mozilla">
<identification>
<userAgent match="Trident/(?'layoutVersion'[7-9]|0*[1-9]\d+)(\.\d+)?;(.*;)?\s*rv:(?'version'(?'major'\d+)(\.(?'minor'\d+)))" />
<userAgent nonMatch="IEMobile" />
<userAgent nonMatch="MSIE " />
</identification>
<capabilities>
<capability name="browser" value="InternetExplorer" />
<capability name="version" value="${version}" />
<capability name="majorversion" value="${major}" />
<capability name="minorversion" value="${minor}" />
<capability name="layoutEngine" value="Trident" />
<capability name="layoutEngineVersion" value="${layoutVersion}" />
<capability name="type" value="InternetExplorer${major}" />
</capabilities>
</browser>
I then copied my browser definitions to the other two servers and ran aspnet_regbrowsers -i and all appears to be working correctly now.
<tr>
<td>
<asp:TextBox ID="txtUsername" runat="server" Text=""
AutoCompleteType="Disabled" CssClass="WaterMarkedTextBox"
TabIndex="1" autocomplete="off" ontextchanged="txtUsername_TextChanged" AutoPostBack="true">
</asp:TextBox>
</td>
<td>
<asp:Label ID="Lbluser" runat="server" Style="color: Red; font-family: Verdana;
font-size: 15px ; font-weight:bold; position:absolute;" ></asp:Label></td>
</tr>
<tr>
<td>
<asp:UpdatePanel ID="updlocation" runat="server">
<ContentTemplate>
<asp:DropDownList ID="ddlLocation" runat="server"
CssClass="WaterMarkedTextBox2" TabIndex="3">
</asp:DropDownList>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="txtUsername" EventName="TextChanged" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
same problem update panel not working in ie10 ……Using the Compatibility View option in the IE10 Tools menu manually update panel work properly…. i dont want change every time Compatibility View
setting …u have solution for this query please revert back..
Comments are closed.