BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

Fix ASP.NET Browser Detection Error in Internet Explorer 11

| by Anand Narayanaswamy on Jan 06, 2014. Estimated reading time: 2 minutes |

Internet Explorer 11 has a bug which prevents ASP.NET applications from running properly. Your users will view broken layout and JavaScript errors, which occurs due to a bug in the browser detection under .NET Framework 4.

You can easily track down the browser detection problem by using F12 development tool available with Internet Explorer, which modifies the user-agent string sent by the browser. In order to work with the tool, you need to press F12, click the Emulation button located at the bottom left and choosing Internet Explorer 9 from the dropdown list. You will be able to see whether the page renders properly immediately after page refresh.

In order to fix the above issue, you need to install .NET Framework 4.5 on the server, which has built-in solution for this problem. However, if you are running Windows 2003 Server then you will have to install patches provided by Microsoft to update browser detection problem in older versions of .NET Framework. Alternatively, you can directly update the application by opening the App_Browsers folder and adding a .browser file with correct definitions as shown below.

<browsers>
  <browser id="IE11" parentID="Mozilla">
    <identification>
      <userAgent match="Trident/(?'layoutVersion'[7-9]|0*[1-9]\d+)(\.\d+)?;(.*;)?\s*rv:(?'version'(?'major'\d+)(\.

(?'minor'\d+)))" />
      <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>

 

 

Rate this Article

Adoption Stage
Style

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Not working when application deployed on Windows Server 2003 by Vipul C

The above browser definition file fixed the issue on my Windows 7 but doesn't seems to work when my application is deployed onto Win Server 2003.
Actually I have a TabContainer as a CustomControl designed in asp.net 4 with following code:

<cc1:AdvancedTabStrip id="subTs" AutoPostBack="True" runat="server"
TabDefaultStyle="background-color:#ffffff;font-family:arial;font-weight:bold;font-size:8pt;color:#000000;width:110;height:21;text-align:center;text-decoration:underline;border-color:#efefef;border-style:solid;border-width:1px;"
TabSelectedStyle="background-color:#ffffff;color:#000000;text-decoration:none;" >
<cc1:AdvancedTabItem ID="tabGeneral" Text="General" ControlToShow="pnlGeneral"></cc1:AdvancedTabItem>
<cc1:AdvancedTabItem ID="tabOpenPeriods" Text="Open Periods" ControlToShow="pnlOpenPeriods"></cc1:AdvancedTabItem>
</cc1:AdvancedTabStrip>

#Problem:
- The tabs simply get displayed as labels rather than LINKs to be clicked

Can you please help me out onto this asap.
Many Thanks in advance

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

1 Discuss

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and dont miss out on content that matters to you

BT