Click here to Skip to main content
15,881,812 members
Articles / .NET
Tip/Trick

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

Rate me:
Please Sign up or sign in to vote.
4.38/5 (8 votes)
29 Apr 2011CPOL1 min read 30.3K   9   13
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)


Written By
CEO
Wales Wales
Born at an early age, he grew older. At the same time, his hair grew longer, and was tied up behind his head.
Has problems spelling the word "the".
Invented the portable cat-flap.
Currently, has not died yet. Or has he?

Comments and Discussions

 
GeneralRe: http://blogs.msdn.com/b/ieinternals/archive/2011/02/11/ie9-r... Pin
Charles Oppermann4-May-11 9:04
Charles Oppermann4-May-11 9:04 
GeneralRe: In IE9 (32-bit) on a Windows 7 (64-bit) machine, when I copy... Pin
Charles Oppermann29-Apr-11 3:53
Charles Oppermann29-Apr-11 3:53 
In IE9 (32-bit) on a Windows 7 (64-bit) machine, when I copy the string and paste it in the Address Bar, only the alert section is shown, the javascript: portion is stripped. That's probably a feature to prevent programs from manipulating the browsr.

I can manually type in the string, but cannot CTRL+V or Right-Click -> Paste the entire string.
GeneralRe: Sorry my fault, misintepretation of 'what works', the javasc... Pin
DaveAuld28-Apr-11 21:53
professionalDaveAuld28-Apr-11 21:53 
GeneralMy 5. I voted for this as an answer before and now used it m... Pin
Sergey Alexandrovich Kryukov5-May-11 13:08
mvaSergey Alexandrovich Kryukov5-May-11 13:08 
GeneralI think I already 5<sup>ed</sup> this in Griff's solution to... Pin
Manfred Rudolf Bihy29-Apr-11 3:45
professionalManfred Rudolf Bihy29-Apr-11 3:45 
GeneralRe: I think you did, but thanks anyway. I am slowly moving my "H... Pin
OriginalGriff29-Apr-11 4:03
mveOriginalGriff29-Apr-11 4:03 
GeneralSmall note: Pasting javascript into the address bar is <stro... Pin
Hariharan Arunachalam29-Apr-11 1:17
Hariharan Arunachalam29-Apr-11 1:17 
GeneralRe: Works fine in IE8 and below; Don't know about IE9, but it is... Pin
OriginalGriff29-Apr-11 1:30
mveOriginalGriff29-Apr-11 1:30 
GeneralIt does work on Chrome 11 :) Pin
DaveAuld28-Apr-11 21:47
professionalDaveAuld28-Apr-11 21:47 
GeneralRe: Not on mine (it updated itself ten minutes ago) - it doesn't... Pin
OriginalGriff28-Apr-11 21:51
mveOriginalGriff28-Apr-11 21:51 
GeneralWorks on Chrome, Doesn't work on IE9 :( yes it does, my bad.... Pin
DaveAuld28-Apr-11 21:39
professionalDaveAuld28-Apr-11 21:39 
GeneralShould have said, i do like the tip though, always wondered ... Pin
DaveAuld28-Apr-11 21:38
professionalDaveAuld28-Apr-11 21:38 
GeneralI read that the new browsers are stripping out alot of the b... Pin
DaveAuld28-Apr-11 21:37
professionalDaveAuld28-Apr-11 21:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.