日期:2014-05-17 浏览次数:20492 次
#region 浏览器设置
private static string[] browerNames = { /*"MSIE",*/ "Firefox", "Opera", "Chrome", "Safari" };
//private const string[] osNames = { "Win", "Mac", "Linux", "FreeBSD", "SunOS", "OS/2", "AIX", "Bot", "Crawl", "Spider","Netscape", "Lynx", "Konqueror" };
/// <summary>
/// 获得浏览器信息
/// </summary>
/// <returns></returns>
public static string GetClientBrower()
{
string agent = HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"];
// SqlHelper.ExecuteUpdate("insert into role(rolename)values('" + agent + "')");
if (!string.IsNullOrEmpty(agent))
{
if (agent.IndexOf("MSIE 7.0") > -1)
return "IE 7.0";
else if (agent.IndexOf("MSIE 8.0") > -1)
return "IE 8.0";
else if (agent.IndexOf("MSIE 9.0") > -1)
return "IE 9.0";
//else if (agent.IndexOf("MSIE") > -1)
// return "IE";
foreach (string name in browerNames)
{
&n