2012-11-03 69 views
1

是否可以使用asp.net/vb.net/c#除IP地址以外的瀏覽器檢測用戶標識。我的目標是檢測用戶訪問計數而不管IP地址;可能是Mac地址或其他?查找用戶標識

感謝

回答

0

你可以得到比從請求對象只是用戶身份的更多

 HttpContext context = HttpContext.Current; 


     string browserInfo = 
      "RemoteUser=" + context.Request.ServerVariables["REMOTE_USER"] + ";\n" 
      + "RemoteHost=" + context.Request.ServerVariables["REMOTE_HOST"] + ";\n" 
      + "Type=" + context.Request.Browser.Type + ";\n" 
      + "Name=" + context.Request.Browser.Browser + ";\n" 
      + "Version=" + context.Request.Browser.Version + ";\n" 
      + "MajorVersion=" + context.Request.Browser.MajorVersion + ";\n" 
      + "MinorVersion=" + context.Request.Browser.MinorVersion + ";\n" 
      + "Platform=" + context.Request.Browser.Platform + ";\n" 
      + "SupportsCookies=" + context.Request.Browser.Cookies + ";\n" 
      + "SupportsJavaScript=" + context.Request.Browser.EcmaScriptVersion.ToString() + ";\n" 
      + "SupportsActiveXControls=" + context.Request.Browser.ActiveXControls + ";\n" 
      + "SupportsJavaScriptVersion=" + context.Request.Browser["JavaScriptVersion"] + "\n"; 

您可以通過訪問用戶身份:

context.Request.ServerVariables["REMOTE_USER"] 

User.Identity.Name