更新时间:2023-01-06 14:28:57
if (Request.IsAuthenticated) {.....}
根据一些评论进行编辑通过表格"进行身份验证,请点击此处
edit based on some comments Authenticated via "Forms", check here
HttpContext.Current.User.Identity.IsAuthenticated
//将为表单"//协商"正在使用集成的Windows//等
HttpContext.Current.User.Identity.IsAuthenticated
// will be "Forms" if using forms based auth
// "Negotiate" is using windows integrated
// etc
如果使用.net 4.5,并且您想要"SET"用户声明.建议阅读 ClaimsPrincipal
If using .net 4.5 and you wanted "SET" user claims. The ClaimsPrincipal is recommended reading