Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting .NET version without UserAgent string

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

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

Javascript detection of the Chrome and Firefox ClickOnce helpers are a start (these are now failing in Firefox 4), but we no longer have a way of detecting if the client has .NET 2.0, 3.5 or 4.0 installed.

Barring from detecting the Windows platform from the UserAgent string and inferring the most likely framework (XP = 1.1, Vista=2.0, Win7=3.5), how could we detect .NET framework support?

(We want to prevent the .application file downloading as most of our clients don't seem to notice the downloading "pop-unders")

like image 813
Jaspio Avatar asked Apr 12 '11 14:04

Jaspio


2 Answers

navigator.userAgent gives you the extended UA string at least on IE9

like image 117
wac Avatar answered Nov 15 '22 08:11

wac


This problem was fixed by Microsoft. The .NET version is now returned as an HTTP request header, "X-ClickOnceSupport".

In PHP, you would get this via getenv()

print getenv('HTTP_X_CLICKONCESUPPORT');

In Perl

print $ENV{HTTP_X_CLICKONCESUPPORT};

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

(This all started by examining the code of the Firefox .NET Assistant, which led me to search for the "X-ClickOnceSupport" header. Nothing like being able to view the source code to solve a mystery!)

like image 30
Stan James Avatar answered Nov 15 '22 08:11

Stan James