开发者

ASP.NET MVC 1 using persistent cookie, intercept loading of user data to include other logic

开发者 https://www.devze.com 2022-12-14 12:08 出处:网络
I am using Forms Authentication for the default MVC site, and i also have a custom DB table with extra user information (LINQ2SQL). I have some logic that loads the extra data from the db when the use

I am using Forms Authentication for the default MVC site, and i also have a custom DB table with extra user information (LINQ2SQL). I have some logic that loads the extra data from the db when the user logs in manually 开发者_Python百科on the site, but the same logic is not executed when the users data is loaded from the persistent cookie stored when they logged in last.

At what point is that users data loaded, and how do i add my own logic during that event?


IN your global.asax you can hook into the PostAuthenticateRequest event.

http://msdn.microsoft.com/en-us/library/system.web.httpapplication.postauthenticaterequest.aspx

    protected void Application_Start()
    {

    }

    protected void Application_PostAuthenticateRequest(object sender, EventArgs e)
    {
        //do stuff with User.Identity here
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消