Link to home
Start Free TrialLog in
Avatar of Ed
EdFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Session variable Timeout asp.net vb

I want to redirect users back to my login page when a certain session variable gets lost expires.

The session variable is called BrokerID

If the value is the session variable gets lost at any time I want to redirect users back to my login page automatically.
ASKER CERTIFIED SOLUTION
Avatar of pkbugudai
pkbugudai
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Nasir Razzaq
If you want to do this when user tries to post back to your site again, you can put a check in page load of every page and redirect the user.

If you want this redirection to happen whether or not user postbacks then you would need to rely on javascript

http://www.codeproject.com/Articles/239798/Session-Timeout-Warning-and-Redirect
Avatar of Ed

ASKER

Solved, thanks.

Solution

       If Session("BrokerID") Is Nothing Then

            Response.Redirect("login.aspx")
        End If

        System.Web.Security.FormsAuthentication.SignOut()