1
양식 인증 티켓의 HTTPContext에 일반 원칙을 추가하는 방법을 알고있는 사람 있습니까?.NET FormsAuthentication 인증 티켓의 일반 사용자
양식 인증 티켓의 HTTPContext에 일반 원칙을 추가하는 방법을 알고있는 사람 있습니까?.NET FormsAuthentication 인증 티켓의 일반 사용자
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);
}
감사합니다. 그게 바로 제가 찾던 것입니다. –