How to synchronize lifetime of forms authentication cookie and Asp.Net Session?

前端 未结 3 1445
走了就别回头了
走了就别回头了 2020-12-30 07:17

I am building an ASP.NET web site that uses FormsAuthentication and a standard Session mechanism with configuration like:



        
3条回答
  •  半阙折子戏
    2020-12-30 07:33

    The reason I sometimes ask myself this question, is to prevent accessing "expired" session objects. When the session expires prior to login expiration, and the user requests a page that uses data from the session, a nasty null reference exception happens.

    You may find this article helpful. It discusses several solutions to detect expired sessions and inform the user about that.

提交回复
热议问题