2
votes

i had created an empty c# web site with just one page with Request.Browser.Version & UserAgent output on it. Then hit it with different Chrome versions using "User-Agent Switcher" Chrome extension.

For time to time, though the Request.UserAgent is correct, Request.Browser.Version seems to return wrong value:

"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.16 Safari/537.36" Returned Request.Browser.Version:39

"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2272.16 Safari/537.36" Returned Request.Browser.Version:41

1
can you provide us some more information about your code?George Netu
No code, empty 4.5 site with only one aspx file that have one line on it <%=Request.Browser.Version%>Ariel K

1 Answers

2
votes

So yes, .net 4.5 caches the user agent by its first 64 chars. And that's just gets them before the version number. So the next user with the same browser but with a different version will get the wrong browser version and so.

To solve it just change the :browserCaps userAgentCacheKeyLength="...", as can be seen here: .Net 4.0 website cannot identify some AppleWebKit based browsers

How isn't this stupid Microsoft bug on the headlines?