Solved

Session Timeouts in asp.net/C#

Posted on 2009-04-09
3
680 Views
Last Modified: 2012-05-06
Redirecting User to Login Page After Session Timeouts
using c#
0
Comment
Question by:chandresh43
3 Comments
 
LVL 5

Accepted Solution

by:
Buginator earned 250 total points
ID: 24109104
Let's say the user has logged in and a session called Username exists.

The following code redirects the user to the loginpage called Login.aspx after the session timeouts:
if (Session["Username"] == null)
{
    Response.Redirect("Login.aspx");
}
else
{
    //You code for logged in users here
}

Open in new window

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question