Search code examples
httpinternet-explorerhttpcontext

HttpContext.Current.Request.Browser.MajorVersion is showing IE11 as IE7


I have a code like this in my web application for a particular validation.

HttpContext.Current.Request.Browser.Browser == "IE" && HttpContext.Current.Request.Browser.MajorVersion<9

If I am running the code in my local it is working fine. However my web application is hosted in Azure and the above condition fails when running the azure application.

I have checked the code and I understood that while rendering my azure application IE11 is taken as IE7.

Could somebody help me in solving the issue


Solution

  • I have resolved it myself. The IE 11 was running in compatibility mode.

    I have the site listed in my Intranet zone

    So, HttpContext.Current.Request.Browser.MajorVersion will be detect the version as 7 when the site is loaded.