我在c#中创建了一个使用用户代理的函数,并返回操作系统及其体系结构。它工作正常,除了Firefox 3.6.28,它显示32位Windows XP而不是64位XP
FF 3.6.28
返回的用户代理字符串“Mozilla / 5.0(Windows; U; Windows NT 5.2; en-US; rv:1.9.2.28)Gecko / 20120306 Firefox / 3.6.28 GTB7.1(.NET CLR 3.5.30729) “
这是代码
HttpBrowserCapabilities browser = Request.Browser;
string platform = browser.Platform;
Response.Write(platform +"</br>");
if (platform.Contains("Win"))
{
Response.Write("Your OS : Windows </br>");
string str = Request.UserAgent;
if (str.IndexOf("WOW64") != -1 || str.IndexOf("Win64") != -1)
{
Response.Write("This is a 64 bit OS </br></br>");
}
else
{
Response.Write("Not a 64 bit OS");
}
Response.Write(str + "</br></br>");
}
else
{
Response.Write("Your OS :Non Windows </br>");
}