Consider below code:
String userAgent = request.getHeader("User-Agent");
In my case "request.getHeader("User-Agent")" method call returns below string.
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 10.0; WOW64; Trident/7.0; .NET4.0C; .NET4.0E)
but when I check my user agent string at http://useragentstring.com
it shows as Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko
which is correct as per browser version shown by the IE browser.
So My concern is that method that I am using is correct or missing something, because the same code returns proper UserAgent String in chrome and Mozilla.
Please check your website, whether it set the X-UA-Compatible meta tag. Try to modify it as below:
<meta http-equiv="X-UA-Compatible" content="IE=edge">
As far as I know, the UserAgent string can be changed by the browser owner, such as change UserAgent string or the iexplore Emulation via the registry. Please navigate to the following registry and check whether it changes the user agent.
Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\User Agent
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_BROWSER_EMULATION
More detail information, please check these link:
Besides, you could also try to reset the IE browser setting, and change it to the default status.
Open IE browser -> click Tools and select the Internet Options -> select the Advanced tab and click the Reset button, checked the Delete personal settings checkbox and check Reset button.