Detecting .NET

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
 
C

Chance Hopkins

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)
 
S

Sherif ElMetainy

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
 
V

Vic

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)
 
V

Vic

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top