操作系统 PlatformID 主版本号 副版本号
Windows95 1 4 0
Windows98 1 4 10
WindowsMe 1 4 90
WindowsNT3.5 2 3 0
WindowsNT4.0 2 4 0
Windows2000 2 5 0
WindowsXP 2 5 1
Windows2003 2 5 2 WindowsVista 2 6 0 Windows7 2 6 1 Windows8
System.OperatingSystem osInfo = System.Environment.OSVersion;
//获取操作系统ID
System.PlatformID platformID = osInfo.Platform;
//获取主版本号
int versionMajor = osInfo.Version.Major;
//获取副版本号
int versionMinor = osInfo.Version.Minor;
System.PlatformID枚举值及其含义
Win32s 是运行于 Windows 16 位版本上的层,它提供对 32 位应用程序的访问。
Win32Windows 操作系统为 Windows 95 或较新的版本。
Win32NT 操作系统为 Windows NT 或较新的版本。
WinCE 操作系统为 Windows CE。
Unix 操作系统为 Unix。
Xbox 开发平台为 Xbox 360。
//C#判断操作系统是否为Windows98
public static bool IsWindows98
{
get
{
return (Environment.OSVersion.Platform == PlatformID.Win32Windows) && (Environment.OSVersion.Version.Minor == 10) && (Environment.OSVersion.Version.Revision.ToString() != "2222A");
}
}
//C#判断操作系统是否为Windows98第二版
public static bool IsWindows98Second
{
get
{
return (Environment.OSVersion.Platform == PlatformID.Win32Windows) && (Environment.OSVersion.Version.Minor == 10) && (Environment.OSVersion.Version.Revision.ToString() == "2222A");
}
}
//C#判断操作系统是否为Windows2000
public static bool IsWindows2000
{
get
{
return (Environment.OSVersion.Platform == PlatformID.Win32NT) && (Environment.OSVersion.Version.Major == 5) && (Environment.OSVersion.Version.Minor == 0);
}
}
//C#判断操作系统是否为WindowsXP
public static bool IsWindowsXP
{
get
{
return (Environment.OSVersion.Platform == PlatformID.Win32NT) && (Environment.OSVersion.Version.Major == 5) && (Environment.OSVersion.Version.Minor == 1);
}
}
//C#判断操作系统是否为Windows2003
public static bool IsWindows2003
{
get
{
return (Environment.OSVersion.Platform == PlatformID.Win32NT) && (Environment.OSVersion.Version.Major == 5) && (Environment.OSVersion.Version.Minor == 2);
}
}
//C#判断操作系统是否为WindowsVista
public static bool IsWindowsVista
{
get
{
return (Environment.OSVersion.Platform == PlatformID.Win32NT) && (Environment.OSVersion.Version.Major == 6) && (Environment.OSVersion.Version.Minor == 0);
}
}
//C#判断操作系统是否为Windows7
public static bool IsWindows7
{
get
{
return (Environment.OSVersion.Platform == PlatformID.Win32NT) && (Environment.OSVersion.Version.Major == 6) && (Environment.OSVersion.Version.Minor == 1);
}
}
//C#判断操作系统是否为Unix
public static bool IsUnix
{
get
{
return Environment.OSVersion.Platform == PlatformID.Unix;
}
}
Request.Browser.MajorVersion.ToString();//获取客户端浏览器的(主)版本号
Request.Browser.Version.ToString();//获取客户端浏览器的完整版本号
Request.Browser.Platform.ToString();//获取客户端使用平台的名字
Request.UserHostAddress.ToString(); //获取远程客户端主机IP
HttpRequest.Url 获取有关当前请求的 URL 的信息。
HttpRequest.UrlReferrer 获取有关客户端上次请求的 URL 的信息,该请求链接到当前的 URL。
HttpRequest.UserAgent 获取客户端浏览器的原始用户代理信息。
HttpRequest.UserHostAddress 获取远程客户端的 IP 主机地址。
HttpRequest.UserHostName 获取远程客户端的 DNS 名称。
HttpRequest.UserLanguages 获取客户端语言首选项的排序字符串数组。
System.Text.StringBuilder strLabel = new System.Text.StringBuilder();
HttpBrowserCapabilities bc = Request.Browser;
strLabel.Append("您的浏览器的分辨率为:");
strLabel.Append("浏览器基本信息:");
strLabel.Append("Type = " + bc.Type + "");
strLabel.Append("Name = " + bc.Browser + "");
strLabel.Append("Version = " + bc.Version + "");
strLabel.Append("Major Version = " + bc.MajorVersion + "");
strLabel.Append("Minor Version = " + bc.MinorVersion + "");
strLabel.Append("Platform = " + bc.Platform + "");
strLabel.Append("Is Beta = " + bc.Beta + "");
strLabel.Append("Is Crawler = " + bc.Crawler + "");
strLabel.Append("Is AOL = " + bc.AOL + "");
strLabel.Append("Is Win16 = " + bc.Win16 + "");
strLabel.Append("Is Win32 = " + bc.Win32 + "");
strLabel.Append("支持 Frames = " + bc.Frames + "");
strLabel.Append("支持 Tables = " + bc.Tables + "");
strLabel.Append("支持 Cookies = " + bc.Cookies + "");
strLabel.Append("支持 VB Script = " + bc.VBScript + "");
strLabel.Append("支持 JavaScript = " + bc.JavaScript + "");
strLabel.Append("支持 Java Applets = " + bc.JavaApplets + "");
strLabel.Append("支持 ActiveX Controls = " + bc.ActiveXControls + "");
strLabel.Append("CDF = " + bc.CDF + "");
strLabel.Append("W3CDomVersion = " + bc.W3CDomVersion.ToString() + "");
strLabel.Append("UserAgent = " + Request.UserAgent + "");
strLabel.Append("UserLanguages = " + Request.UserLanguages[0].ToString() + "");
strLabel.Append("");
strLabel.Append("客户端计算机基本配置:");
strLabel.Append("UserHostName = " + Request.UserHostName + "");
strLabel.Append("UserHostAddress = " + Request.UserHostAddress + "");
strLabel.Append("PDF 6.0 插件是否安装 = " + Request.Form["PDF"] + "");
Label1.Text = strLabel.ToString();