views:

147

answers:

4

Hello,

is there any way of checking with an ASP.NET webpage if the client pc has the NET framework 2.0 installed?

+4  A: 

You can use Server Variables located in the HttpRequest object to check to see if the framework is installed. The frame work version is in the HTTP_USER_AGENT and would look something like this:

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)

Miyagi Coder
Most of the time that only works in IE, but MS is aggressively pushing a firefox extension that will add this information as well.
Joel Coehoorn
+2  A: 

string version = Request.Browser.ClrVersion.ToString();

This I think will reveal the clr version. If this is not enough, you would need an object downloaded to the client to investigate the clients computer.

This works fine in IE and FireFox, but Google Chrome returns 0.0. I haven't got access to other browsers here to test.
ZombieSheep
A: 

http://www.ivertech.com/sharedPages/howToCheckDotNetFrameworkVersionSourceCode.aspx

That link will show you how to retrieve ALL of the .NET versions on the computer.

+1  A: 

for anyone else interested...

http://msdn.microsoft.com/en-us/library/ms994415.aspx

Chocol8