rt

解决方案 »

  1.   

    void Application_AuthorizeRequest(object sender, EventArgs e) 
        {
            HttpApplication app = (HttpApplication)sender;
            HttpContext ctx = app.Context;
            //if user authencticated already
            if (ctx.Request.IsAuthenticated == true)
            {
                FormsIdentity id = (FormsIdentity)ctx.User.Identity;
                FormsAuthenticationTicket ticket = id.Ticket;
                string[] roles = ticket.UserData.Split(new char[] { ',' });
                ctx.User = new GenericPrincipal(id, roles);
            }
        }
    ticket就是身份验证票,ctx.User 是当前用户