是否可以使用除IP地址之外的asp.net/vb.net/c#从浏览器检测用户身份。我的目标是检测用户访问次数,无论IP地址如何;可能是Mac地址等?
由于
答案 0 :(得分: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