如何检查会话是否在asp.net中过期或不

问题描述:

我已经指定的会话超时在web.config中file..when会话超时是即时消息没有得到重定向到登录页面,但我歌厅错误说对象引用未设置为一个实例。

i ve specified the session time out in web.config file..when the session is timeout im not getting redirect to login page but i am geting error saying object reference not set to an instance.

任何一个可以告诉我,这个解决方案?

can any one tell me the solution for this?

您可以检查 HttpContext.Current.User.Identity.IsAuthenticated 属性,它可以让你知道是否有一个当前已验证用户或没有。

You can check the HttpContext.Current.User.Identity.IsAuthenticated property which will allow you to know whether there's a currently authenticated user or not.