Internet-Explorer – http_user_agent and navigator.USERAGENT are different, is there any idea?

I use Javascript on the client to obtain navigator.userAgent, and return:

Mozilla/5.0 (compatible; MSIE 9.0 ; Windows NT 6.1; Win64; x64; Trident/5.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; HPNTDF; .NET4.0C; .NET4 .0E)

Use C#Request.ServerVariables [“HTTP_USER_AGENT”], return:

Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1 ; Win64; x64; Trident/5.0)

As you can see, its IE :(.

IE always does this, or is it just me?
How Get the same value?

PS, I even tried this in the local IIS, with the same result

The user agent string in Internet Explorer 9 and higher is almost always different, between the version sent in the HTTP request and the version obtained through navigator.userAgent. This is because the so-called Feature tags. The background is explained here: http://msdn.microsoft.com/en-us/library/ms537503%28v=vs.85%29.aspx

From the msdn documentation:< /p>

Earlier versions of Internet Explorer included feature tokens defined using the Pre-Platform and Post-Platform keys part of the user-agent string during the HTTP negotiation process. Over time, this lead to overly long user-agent strings, which in turn created problems for certain web servers. Problems usually appeared when user-agent strings were longer than 256 characters. As of Internet Explorer 9, the user-agent string no longer includes feature tokens during HTTP negotiation. Feature tokens are included in the value returned by the userAgent property of the navigator object. Applications that rely on the earlier behavior should be modified accordingly.

You have to decide which witch you want to use in your application. There is no way to “synchronize” them. The one obtained via Javascript should contain more information…

The client uses Javascript to obtain navigator.userAgent and returns:

Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; HPNTDF; .NET4.0C; .NET4.0E)

Use C# Request.ServerVariables [“HTTP_USER_AGENT”], return:

Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64 ; Trident/5.0)

As you can see, its IE :(.

IE always does this, or is it just me?
How to get the same value?

PS, I even tried this in local IIS with the same result

User agent in Internet Explorer 9 and later The string is almost always different, between the version sent in the HTTP request and the version obtained through navigator.userAgent. This is because of the so-called feature tag in the string. Here is the background: http://msdn.microsoft.com /en-us/library/ms537503%28v=vs.85%29.aspx

From the msdn documentation:

Earlier versions of Internet Explorer included feature tokens defined using the Pre-Platform and Post-Platform keys part of the user-agent string during the HTTP negotiation process. Over time, this lead to overly long user-agent strings, which in turn created problems for Certain web servers. Problems usually appeared when user-agent strings were longer than 256 characters. As of Internet Explorer 9, the user-agent string no longer includes feature tokens during HTTP negotiation. Feature tokens are included in the value returned by the userAgent property of the navigator object. Applications that rely on the earlier behavior should be modified accordingly.

You have to decide which witch you want to use in your application. There is no way to “synchronize” them. Javascri The one obtained by pt should contain more information…

Leave a Comment

Your email address will not be published.