You need to use Internet Explorer in order to find out if Microsoft .Net Framework is installed on your computer.
We constantly get requests from programmers asking us to disclose our source code on how to detect
what versions of Microsoft .Net Framework are currently installed on the client (for an ASP .Net web application).
Instead of emailing the source code to the programmer every time we get a request, we have decided to share it
with the public.
Here's the source code to detect all versions of .Net Framework that are currently installed
on a client (in C#):
public partial class howToCheckDotNetFrameworkVersionSourceCode : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
string messageToDisplay = "";
if (Request.Browser.Browser.ToUpper() == "IE")
Version versionArray = Request.Browser.GetClrVersions();
bool dotNetFrameworkFound = false;
if (versionArray.Length > 0)
dotNetFrameworkFound = true;
if (dotNetFrameworkFound == true)
messageToDisplay = "Microsoft .Net Framework version(s) installed on your " +
foreach (Version version in versionArray)
messageToDisplay += version.ToString() + "<br>";
messageToDisplay = "Microsoft .Net Framework is not installed on your computer.";
messageToDisplay = "You need to use Internet Explorer in order to find out if " +
"Microsoft .Net Framework is installed on your computer.";
messageLabel.Text = messageToDisplay;
The code above needs to reside in an aspx.cs file in your ASP .Net web application.
You will need to create a label called "messageLabel" to display the results.
This piece of code will work only if the client is using Internet Explorer. We still
have not found any source code that would work across all browsers. If you are aware of
any source code that would work for all browsers, please contact us.
Many programmers get burned using the Request.Browser.ClrVersion object, thinking that it
is the only way to figure out what the client's .Net Framework version is. What they
do not know is Request.Browser.ClrVersion only give them the latest version of .Net Framework
installed on the client's machine. If the intent is to look for a specific version
of .Net Framework, Request.Browser.ClrVersion is not an appropriate object to use.
We use the Request.Browser.GetClrVersions() to retrieve an array of Version objects.
This Version array contains all versions of .Net Framework installed on the client's computer.
Each Version object contains Major, Minor, Build, and Revision properties. You can interrogate
these properties to find the specific version of .Net Framework that you are looking for.
This is not officially documented by Microsoft, but Request.Browser.GetClrVersions() method actually retrieves
the array of Version objects from the registry. The exact location of the registry is:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP
If you are having problem retrieving the versions of .Net Framework that you expect, use Regedit to navigate to
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP and find out if the entries are there.
Now you have it, our complete and working source code on how to check .Net Framework versions!
Please note that the source code provided will only work if you are running an ASP .Net web application.
It will not work if your user is running a regular Windows application.
Please contact us if you have any questions or suggestions about our code.