Let's assume you have a site with a master page that has a few simple pages and that the user has logged in. As part of the login process assign something to the Session, perhaps like
Session.Add(Key, Value);
. You can then test for this value each time the user, for instance, navigates to another page or initiates a PostBack event.
You could do:
if (Session[Key] == null)
{
}
If the Session has expired the Session variable will be null which you can test for and take the appropriate action.