AuthenticateRequest event

前端 未结 2 1769
心在旅途
心在旅途 2020-11-30 23:50


Q 1. To my understanding FormsAuthenticationModule is subscribed to AuthenticateRequest event, and thus only after this event is fired

2条回答
  •  时光说笑
    2020-12-01 00:14

    If you want access to the User object, I'd suggest you use

    protected void Application_Start()
    {
        PostAuthenticateRequest += Application_PostAuthenticateRequest;
    }
    
    protected void Application_PostAuthenticateRequest(object sender, EventArgs e)
    {
        if(User.Identity.IsAuthenticated)
        {
            //Do stuff here
        }
    }
    

提交回复
热议问题