2011-08-19 324 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 –