2011-05-12 32 views

回答

2

你應該使用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; 
    ... 
} 
+2

等待,我敢肯定Identity.Name擁有的用戶名,無論模擬是否啓用。 – 2011-05-12 21:50:25

相關問題