2011-08-19 229 views

回答

1

你可以得到的用戶名像...

string username = HttpContext.Current.User.Identity.Name.ToString(); 

一旦你的用戶名可以在頁面重定向到一個特定的頁面。

編輯:可以在Application_AuthenticateRequest事件做到這一點,那就是Global.asax文件

protected void Application_AuthenticateRequest(object sender, EventArgs e) 
{ 
    if (Request.IsAuthenticated) 
    { 
     // put code here.... 
    } 
} 
+0

非常感謝,你能告訴我在哪個事件中我可以把這個? –

+0

我已經更新了我的答案。其次,我會推薦閱讀這篇文章http://weblogs.asp.net/scottgu/archive/2006/07/12/Recipe_3A00_-Enabling-Windows-Authentication-within-an-Intranet-ASP.NET-Web-application。 aspx –

+0

看看這個以及http://msdn.microsoft.com/en-us/library/ff647405.aspx –

1

非常簡單

protected void Page_Load(object sender, EventArgs e) 
    { 
     string username = HttpContext.Current.User.Identity.Name.ToString(); 

     if (username == "someusername") 
     { 
      Response.Redirect("someaspxfile.aspx"); 
     } 
    } 
1

如果您正在尋找拿起控制裝置與它的用戶名,這將是在要求提供。你可以從請求中挑選數據

+0

你能否提供一些coed –