Reputation: 584
My original issue was my website giving error on postback only on some iPhone and iPad devices. The site worked fine for all desktop computers as well as most of the other phones. The error was device specific and not browser specific. I found answer to that in following discussions-
.Net 4.0 website cannot identify some AppleWebKit based browsers
ASP.NET Ajax postback suddenly stops on IPhone/IPad
The gist of these discussions is-
"The .NET framework caches the user agent keys. The default size for user agent cache is 64 characters. Meaning, .NET caches first 64 characters of the UserAgent string as key. So next time a user whose UA starts with same 64 characters visits the site, it is mapped to the previously stored key in the memory. The website now behaves the same way for this new user agent.
In most cases, this is not an issue, but occasionally a user agent pops up that looks like a Safari, but really isn't and that one is not resolved properly (Mozilla 0.0 with no capabilities whatsoever), but the mapping is still stored in the cache, which means that all UserAgent strings with the same 64 character prefix (which happens to be exactly equal to that of so many normal Safaris), are now incorrectly mapped as well until that cache entry expires."
Adding browserCaps with user agent length of 256 resolved that problem for some devices but not for the ones that use chrome as well as safari on their ipad/iphone.
Is there any way to clear these cached user agents? clearing browser cache on both browsers doesn't seem to work.
Upvotes: 1
Views: 820
Reputation: 584
After doing some digging online, I found a way to clear this cache-
Source: https://msdn.microsoft.com/en-us/library/ms228122(v=vs.85).aspx
Changes to .browser files located in the App_Browsers directory invalidate the cache, and the next request will cause the application to recompile.
However, if changes are made to .browser files in the %SystemRoot%\Microsoft.NET\Framework\version\CONFIG\Browsers directory, you must manually recompile the application by using the %SystemRoot%\Microsoft.NET\Framework\version\aspnet_regbrowsers.exe tool, or you must programmatically recompile it by using the BrowserCapabilitiesCodeGenerator class.
It doesn't specify what changes you should do, but I am assuming any external change would force it to recompile. I am yet to test this, just wanted to put it out here in case anyone has tried this.
Upvotes: 1