How to Check whether Session is Expired or not in asp.net

asp.net, c#

Solution

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.

Problem

I've specified the session timeout in web.config file. When the session is timeout I'm not getting redirect to the login page but I am getting an error saying object reference not set to an instance. Can anyone tell me the solution for this?

Original source

Related problems