2
在ASP.NET模拟,可以使用Environment.UserName
确定模拟工作?这就是说,如果该网站正在冒充,应该Environment.UserName
返回我的用户名?如何判断ASP.NET模拟是否正常工作?
在ASP.NET模拟,可以使用Environment.UserName
确定模拟工作?这就是说,如果该网站正在冒充,应该Environment.UserName
返回我的用户名?如何判断ASP.NET模拟是否正常工作?
你应该使用User.Identity.Name
:
[Authorize]
public ActionResult Foo()
{
// If we got so far it means that the user is authorized to
// execute this action according to our configuration =>
// we can work with his username
string username = User.Identity.Name;
...
}
等待,我敢肯定Identity.Name拥有的用户名,无论模拟是否启用。 – 2011-05-12 21:50:25