2

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

Ariel K
  • 61
  • 6

1 Answers1

2

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?

Community
  • 1
  • 1
Ariel K
  • 61
  • 6