开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜