Products Technologies Demo Docs Blog Support Company

ASP.NET: Getting the Client's .NET Version

To use TX Text Control Server for ASP.NET (incl. Windows Forms)'s BrowserTextControl in the Internet Explorer, the .NET Framework must be installed on client-side. A client-side control is required to provide the true WYSIWYG editing interface. If no .NET Framework is installed, you might redirect your users to a download and install page for all prerequisites. If you want to avoid external controls or Javascript to check whether a .NET Framework is installed, there is only one way to get…

ASP.NET: Getting the Client's .NET Version

To use TX Text Control Server for ASP.NET (incl. Windows Forms)'s BrowserTextControl in the Internet Explorer, the .NET Framework must be installed on client-side. A client-side control is required to provide the true WYSIWYG editing interface.

If no .NET Framework is installed, you might redirect your users to a download and install page for all prerequisites.

If you want to avoid external controls or Javascript to check whether a .NET Framework is installed, there is only one way to get this information from the client: Using the user agent information the browser discloses. Using the HTTP server variables, a string can be requested that describes the browser in detail.

Request.ServerVariables["HTTP_USER_AGENT"]

This returns a string like this:

Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; .NET CLR 1.1.4322; InfoPath.1)

It shows that my machine is running Windows Vista (NT 6.0), I am browsing with Internet Explorer 7.0 and that 3 versions of the .NET Framework are installed: 1.1, 2.0 and 3.0.

Now, we simply need to split the returned string to get the specific versions.

ArrayList agentVariables = new ArrayList(Request.ServerVariables["HTTP_USER_AGENT"].Split(\';\'));
foreach (string variable in agentVariables)
{
    if (variable.StartsWith(" .NET"))
        ListBox1.Items.Add(variable.Trim());
}

The above code fills a list box with the available .NET Frameworks.

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Related Posts

BrowserTextControl

TX Text Control Security Wizard Available

In order to run the BrowserTextControl component in Internet Explorer, the .NET Framework security mechanism Code Access Security (CAS) must be adjusted. Our documentation describes how to adjust…


BrowserTextControl

Overriding IE's Predefined Shortcuts Like CTRL-B

CTRL-B is the de facto standard shortcut for making a selection bold in word processing applications. When trying to implement that into a BrowserTextControl based user control that is used in…


BrowserTextControlSampleVisual Studio

BrowserTextControl: Using Post-build Events in Visual Studio

When developing with TX Text Control Server for ASP.NET (incl. Windows Forms) and it's BrowserTextControl class, you might have learned that you need to clear the .NET download cache (dl3)…


BrowserTextControlServerTextControl

BrowserTextControl: Compressed File Transfer

The BrowserTextControl class allows developers to deploy true WYSIWYG word processing applications to the web. Using this .NET component, it is possible to load, modify and save fully featured MS…


BrowserTextControl

Activating the BrowserTextControl Automatically

Since objects like Flash, ActiveX controls or .NET assemblies must be activated in Internet Explorer manually, you have to click on it to be able to use them. This is also valid for the…