ASP.NET: How to detect .NET version from Browser - using User-Agent string.
Filed in ASP.NET on Apr.16, 2007
This code will help you to fetch the .NET versions installed on the client browser.
/* Author: Praveen */
< %@ Page Language="c#" ContentType="text/html" %>
< %
string useragent = Request.ServerVariables["HTTP_USER_AGENT"];
System.Text.RegularExpressions.Regex r = new System.Text.RegularExpressions.Regex(".NET CLR [0-9.]*");
bool flag = false;
foreach (Match m in r.Matches(useragent))
{
Response.Write("
flag = true;
}
if (!flag)
{
Response.Write(”You have NO .NET frameworks installed”);
}
%>
Result will be somewhat like:
Related posts:























Leave a Reply
You must be logged in to post a comment.