PDA

View Full Version : مشخص شدن نوع سیستم عامل کاربر



ramin149
پنج شنبه 10 اسفند 1391, 13:06 عصر
با سلام . من با کد زیر نوع سیستم عامل کاربر را می گیرم . اما نمی دونم برای windows 8 , windows server 2012 ورژن Windows NT در asp.net چی است .لطفا راهنمایی کنید .

public static string GetOperatorSystem()
{
if (HttpContext.Current.Request.UserAgent.IndexOf("Windows 95") > 0)
{
return "Windows 95";
}
else if (HttpContext.Current.Request.UserAgent.IndexOf("Windows 98") > 0)
{
return "Windows 98";
}
else if (HttpContext.Current.Request.UserAgent.IndexOf("Windows NT 5.0") > 0)
{
return "Windows 2000";
}
else if (HttpContext.Current.Request.UserAgent.IndexOf("Windows NT 5.1") > 0)
{
return "Windows XP";
}
else if (HttpContext.Current.Request.UserAgent.IndexOf("Windows NT 5.2") > 0)
{
return "Windows Server 2003";
}
else if (HttpContext.Current.Request.UserAgent.IndexOf("Windows NT 6.0") > 0)
{
return "Windows Vista";
}
else if (HttpContext.Current.Request.UserAgent.IndexOf("Windows NT 6.1") > 0)
{
return "Windows 7";
}
else if (HttpContext.Current.Request.UserAgent.IndexOf("Windows NT 6.2") > 0)
{
return "Windows Server 2012";
}
else if (HttpContext.Current.Request.UserAgent.IndexOf("Mac OS X") > 0)
{
return "Mac OS X";
}
else if (HttpContext.Current.Request.UserAgent.IndexOf("Linux") > 0)
{
return "Linux";
}
else
return "none";
}

morteza_mokhtari
پنج شنبه 10 اسفند 1391, 22:23 عصر
با این کد این کار رو انجام بذه


statistics.Platform = Request.Browser.Platform;