是否可以使用除 IP 地址之外的 asp.net/vb.net/c# 从浏览器检测用户身份。我的目标是检测用户访问次数,而不考虑 IP 地址;可能是Mac地址等?
谢谢
您可以从请求对象获得的不仅仅是用户身份
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