Redirecting to another page on Session_end event

前端 未结 7 1391
心在旅途
心在旅途 2020-12-03 06:13

I would like to auto-redirect to login page when session time outs.

In web.config file, i have the following code


    

        
7条回答
  •  一生所求
    2020-12-03 06:22

    If you are using something like FormsAuthentication for maintaining the security of your application, then this part (that part that you are trying to do) will be done for you. If FormsAuthentication discovers that a user's session has expired it will redirect him or her back to you login page.

    Second, don't rely too much on Session_End because it will never trigger if you change session provider from InProc to SQLServer or other out of process provider.

提交回复
热议问题