Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / .NET

A safe way to get the user to check if the .NET framework is installed

4.38/5 (8 votes)
29 Apr 2011CPOL1 min read 32.3K  
Sometimes, it is helpful to find out if the .NET framework is installed on a machine, or get a user to check over the phone. But, some people should not be allowed near Regedit or the windows folder, so here is a safe way to get them to check.
Personally, I don't like that you can execute code in the address bar of any browser: I think it is a potential security risk. But, if you are on the phone to a custard (a cross between a customer and a b@stard), then this is a simple method that even a pretty non-technical person can cope with!

The only other ways I know of for a user to check what versions (if any) are installed on a machine are to look in the registry (and some people should not be allowed near Regedit), or to check for a folder called "Microsoft.NET\Framework\" under the main Windows directory (which may not be available to all users) and see what sub-directories exist. Since this means them looking into the Windows directory, I don't like to go there either - the damage a "non-technical person" can do without thinking is quite staggering, sometimes.

This method can be used very easily over the phone, and requires nothing that (probably) isn't installed already: Internet Explorer (it definitely doesn't work in Chrome, and probably won't in Firefox.)

Bring up Internet Explorer and paste into the address bar (note the upper- and lower-case, it is important):
XML
javascript:alert(navigator.userAgent)

Press ENTER.

You will get a popup saying something along the lines of:
Mozilla/4.0 (compatible; MSIE8.0; Windows NT 5.1; Trident/4.0;

Followed by a number of ".NET CLR" versions. All the user has to do is read out the message box content.

Simples!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)