Detecting .NET Version Without UserAgent String

Most modern browsers (Chrome 10, Firefox 4, IE9) abbreviate UserAgent identifiers. As a result, supported versions of .NET are no longer sent to the server.

In order for our customers to use our ClickOnce application, we need to know which platforms are supported by the client.

Javascript discovery for the Chrome and Firefox ClickOnce helpers is the beginning (they no longer work in Firefox 4), but we no longer have a way to determine if .NET 2.0, 3.5 or 4.0 is installed on it.

It is impossible to detect the Windows platform from the UserAgent line and deduce the most probable structure (XP = 1.1, Vista = 2.0, Win7 = 3.5), how can we detect support for the .NET platform?

(We want to prevent the .application file from loading, as most of our clients do not seem to notice the loading of "pop-unders")

+7
source share
4 answers

This issue has been fixed by Microsoft . The .NET version is now returned as the header of the HTTP request, "X-ClickOnceSupport."

In PHP you will get this via getenv ()

print getenv('HTTP_X_CLICKONCESUPPORT'); 

In perl

 print $ENV{HTTP_X_CLICKONCESUPPORT}; 

In JavaScript, this is not possible, according to this answer .

(It all started with exploring the Firefox.NET Assistant code, which made me look for the “X-ClickOnceSupport” header. Nothing like looking at the source code to solve the puzzle!)

+2
source

navigator.userAgent provides extended UA string at least on IE9

+4
source

I see no way to do this. If the browser does not tell your server which frameworks are installed, then you have no other way to find out.

+1
source

The way I ran into this problem was to send back the response header, in which the browser should work in compatibility, and then discovered the javascript version of the framework in navigator.userAgent.

Code Code:

 Response.Headers.Add("X-UA-Compatible", "IE=7"); 

Javascript per page

 // js to detect .net 3.5 // if it evaluates to true, then the user has .NET 3.5 installed alert(navigator.userAgent.search(/\.NET.*?3\.5[\.\da-z]*?;/i) > -1); 
+1
source

All Articles