2011-03-02 7 views

답변

3

Application_AuthenticateRequest 이벤트에서이 작업을 수행 할 수 있습니다. Here's an example :

protected void Application_AuthenticateRequest(Object sender, EventArgs e) 
{ 
    var user = HttpContext.Current.User; 
    if (user == null || !user.Identity.IsAuthenticated) 
    { 
     return; 
    } 
    // read the roles from the cookie and set a custom generic principal 
    var fi = (FormsIdentity) HttpContext.Current.User.Identity; 
    var fat = fi.Ticket; 
    var astrRoles = fat.UserData.Split('|'); 
    HttpContext.Current.User = new GenericPrincipal(fi, astrRoles); 
} 
+0

감사합니다. 그게 바로 제가 찾던 것입니다. –