Detecting .NET

  • Thread starter Thread starter Vic
  • Start date Start date
V

Vic

Hello, All.

Is there any way for an ASP.NET page to detect whether a client has .NET
framework installed (preferebly to also determine the version). So, the
resultant application would look something like that:

User clicks a button called "Detect .NET version" on a page1.apsx. The
result is a label that reads "you have .NET version 1.1 installed" or ".NET
framework isn't detected on your PC".

Any hints/links are greatly appreciated.

Thanks.
Vic
 
yes, it's in the user agent, http refer string

you could do a comparison on the string or use a regex to see if it's there

examples
-------------------------------------

version 1:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)

both versions:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)


not there:
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.4) Gecko/20030624 Netscape/7.1

Mozilla/5.0 (compatible; Konqueror/3.0-rc3; i686 Linux; 20021211)
 
Hello

As Chance stated you can use the user agent header. The easier way is using
Request.Browser.ClrVersion Property. Actually this is the same, method
because .NET detects the ClrVesion by parsing the user agent string. So you
will have .NET parse it instead of using regular expressions.

Best regards
Sherif
 
Thanks.
Vic

Chance Hopkins said:
yes, it's in the user agent, http refer string

you could do a comparison on the string or use a regex to see if it's there

examples
-------------------------------------

version 1:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)

both versions:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705; .NET CLR 1.1.4322)


not there:
Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.4) Gecko/20030624 Netscape/7.1

Mozilla/5.0 (compatible; Konqueror/3.0-rc3; i686 Linux; 20021211)
 
Thanks.
Vic

Sherif ElMetainy said:
Hello

As Chance stated you can use the user agent header. The easier way is using
Request.Browser.ClrVersion Property. Actually this is the same, method
because .NET detects the ClrVesion by parsing the user agent string. So you
will have .NET parse it instead of using regular expressions.

Best regards
Sherif
 
Back
Top