如何检查会话是否在asp.net中过期或不 [英] How to Check whether Session is Expired or not in asp.net

查看:126
本文介绍了如何检查会话是否在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.

这篇关于如何检查会话是否在asp.net中过期或不的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆