ASP.Net Session Timeout detection: Is Session.IsNewSession and SessionCookie detection the best way to do this?

后端 未结 2 1388
南旧
南旧 2020-12-09 13:03

When my ASP.Net session times out (and forms authentication as well) and I try to hit a page, I am automatically redirected to my default login.aspx page.

Before th

2条回答
  •  长情又很酷
    2020-12-09 13:45

    You may also look in you web.config file under the tag authentication. This should look something like this:

    
      
      
    
    

    Notice the attribute mode, it probably says Forms instead of Window in you web.config file. In this case, if you lose your session and then click on any link (let's say SalesChart.aspx) ASP.NET will take you directly to Login.aspx codebehind instead of SalesChart.aspx codebehind which is particularly annoying.

    If you try Windows mode, you will be taken to the requested page (SalesChart.aspx) everytime, and then decide on your own what action to take if session is lost.

提交回复
热议问题