ASP.NET: Getting the Client's .NET Version
TX Text Control Server for ASP.NET requires .NET Framework on the client machine for BrowserTextControl. This article shows how to detect installed .NET versions server-side by parsing the HTTP_USER_AGENT string, avoiding any dependency on JavaScript or external controls.

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.
Related Posts
TX Text Control Security Wizard Available
A downloadable Security Wizard application simplifies .NET Code Access Security configuration for BrowserTextControl in Internet Explorer. Deployed via ClickOnce, the tool runs with elevated…
Overriding IE's Predefined Shortcuts Like CTRL-B
Internet Explorer intercepts CTRL-B and CTRL-I when a BrowserTextControl is hosted in a user control, triggering browser dialogs instead. Overriding ProcessCmdKey in the user control captures…
BrowserTextControlSampleVisual Studio
BrowserTextControl: Using Post-build Events in Visual Studio
During BrowserTextControl development on a local machine, Internet Explorer caches the user control and skips re-downloading it when the codebase changes. Adding gacutil.exe /cdl as a Visual…
BrowserTextControlServerTextControl
BrowserTextControl: Compressed File Transfer
TX Text Control Server for ASP.NET 14.0 replaces .NET remoting with a new file I/O model for BrowserTextControl. ServerTextControl converts MS Word documents to byte arrays, which are sent to the…
Activating the BrowserTextControl Automatically
Internet Explorer requires users to manually click embedded .NET controls before interacting with them. This workaround loads an external JavaScript file that dynamically creates and appends the…
