How can I handle forms authentication timeout exceptions in ASP.NET?

前端 未结 3 1385
醉话见心
醉话见心 2020-11-29 07:03

If the session has expired and the user clicks on a link to another webform, the asp.net authentication automatically redirect the user to the login page.

However, t

3条回答
  •  情书的邮戳
    2020-11-29 07:35

    If you're using a master page or a base page, I would add some logic to one of the events in the page lifecycle to check whether the session is new:

    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session.IsNewSession)
        {
            //do whatever you need to do
        }
    }
    

提交回复
热议问题