Wednesday, September 26, 2007

How to Detect if Microsoft's .NET is installed via Web Browser

I have been tasked with figuring out how to detect if the Microsoft .NET runtime is installed through a web browser. At first I thought no friggin way. I'm sure there isn't an easy way. But after doing some looking around it looks like when a user installs the .NET runtime it appends the registry key user agent string value so that EVERY SINGLE WEB REQUEST will mark in IE specifically if .NET is installed. So now this means I can check for this specifically and handle it accordingly.

Below is a quote and an example from the post I read to learn this:

"When the .NET run-time is installed, IE6 is updated and it appends whatever is found in the following registry key, in the user agent string of every single web request : HKLM/Software/Microsoft/Windows/CurrentVersion/Internet Settings/5.0/User Agent/Post Platform "

HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 1.0.3705)

http://blogs.msdn.com/astebner/archive/2004/09/14/229574.aspx

 

Here is another quote from Christopher Vaughan the lead project manager for the Internet Explorer team and what he has to say about detecting .NET from the browser:

"XPSP2 and its slightly updated user agent string

Hi, I’m Christopher Vaughan, and I’m the lead project manager for the Internet Explorer team. I’ve worked on IE on and off since the IE 3.0 days, and have been involved in every major Windows release since Windows 95. I work with Dean, Scott, Tony, Dave, and the others who have or will be posting here to make sure that the IE team is working on the right things and at the right times.

I wanted to drop a quick note to make sure people knew about an update to our user agent string in Windows XP Service Pack 2. We’ve added "SV1" to the UA string so it’ll start looking something like this:

HTTP_USER_AGENT:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 1.0.3705)

This will let site authors know that they’re being visited by someone who’s running an IE browser on the latest, most secure Microsoft platform. Right now only XPSP2 has this token, but soon you’ll see this token show up on other platforms as we bring our security enhancements to them.

SV1 stands for "Security Version 1" by the way. We’re proud of the security work that we’ve done in XPSP2 and wanted to be sure that site authors had some way to differentiate users running the latest version of IE.

Also, I'd like to remind folks that there's an online chat scheduled with members of the IE team on September 9th. See the chat schedule for details. See you there!

Till next time!
-Christopher"

http://blogs.msdn.com/ie/archive/2004/09/02/224902.aspx


0 comments: