views:

146

answers:

2

I need to device a way to learn if the user who surfs to my site has dotnet framework installed on his computer, and which version (less important).
I need this to work at least with Firefox and IE 7 and up.

Any ideas?

(Is there any web service the Framework on the "localhost" exposes?)

+4  A: 

.NET Framework alters the user agent of the popular browsers. You can check the user agent to find out.

Firefox:

Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8 (.NET CLR 3.5.30729)

IE:

Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30618; InfoPath.2)

Mehrdad Afshari
+1  A: 

An example showing the use of Mehrdad's answer in ASP.NET is here. The concepts should apply for you.

JeffH