How can you detect if someone has Microsoft's .NET Framework
installed?
Microsoft has spent millions (if not billions) of dollars
promoting its .NET framework. A lot of web developers (esp.
ASP developers) have installed it to play around with it as
it is free to download.
As a web developer, you may raise an interesting question:
Is there a way to detect if a machine has the .NET Framework
installed? The answer is, of course, YES. (Otherwise,
I wouldn't be writing this article and you wouldn't be reading
thus far. :P). The way to detect it is amazingly simple. Even
a layman can understand it!
When you install the .NET Framework, not only does it add
new program files to your PC, but it also changes the behavior
of some existing programs. In particular, it changes one thing
in your IE (Internet Explorer) -- It modifies the User-Agent
information of your IE so that it includes the version number
of your .NET Framework.
What the heck am I talking about? Let's see a demonstration.
Go to Asp.net's
Web Matrix Project page. Then click on the link that reads
"Click here to see if you have the .NET Framework installed".
The subsequent page will then tell you whether you have .NET
installed.
How did they do that? Take a look at what actually happened
when you clicked on that link:

See? The highlighted HTTP header reads
| User-Agent: Mozilla/4.0 (compatible;
MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705) |
Before the .NET framework was installed, it read "User-Agent:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)". Now
that .NET has been installed, it carries some extra information
-- .NET CLR 1.0.3705. It's this new piece of information
that enables the detection of .NET Framework by the ASP/ASP+
page.
In traditional ASP page, you can retrieve the User-Agent
information from the server variable:
| Request.ServerVariables("HTTP_USER_AGENT")
|
Yes, that's it. Isn't it incredibly simple? I hope you enjoyed
the discussion. I found out the above with HttpRevealer.
You can explore the web yourself too! [See
more info]
Steven Chau
Go back to the Index of Articles
Microsoft is a registered trademark of Microsoft Corporation.
All other marks are properties of their respective owners.
|