When using Forms authentication is there a way to redirect the user back to the login page if they are inactive for a given period of time.

I have an application that uses forms authentication to Authenticate against the Active Directory.  If there is no activity for 30 minutes or more and the user then tries to do anything, navigate to a different page, click the submit button etc. I want them to be redirected back to the login page.

In the Web.config file I have the following entries:

    <authentication mode="Forms">
        <forms loginUrl="logon.aspx" name="adAuthCookie" timeout="30" path="/"></forms>
   </authentication>

    <sessionState mode="InProc"
            stateConnectionString="tcpip=127.0.0.1:42424"
            sqlConnectionString="data source=127.0.0.1;user id=sa;password="
            cookieless="false"
            timeout="30"/>

What happens when the use tries to navigate to a new page after 30 minutes is the session has expired so when the code on the page they are navigating to looks for a session variable it throws an error.  I want them to be sent back to the login page where they can login again, the session variables will be reset and they will then get redirected to the page they want.
leskellyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

smolamCommented:
When the user logs in are you setting the Session.Timeout equal to the Forms.Timeout?  Are you saving a persistant authentication cookie or just using the standard cookie?  Please could you post your authentication procedure?
0
leskellyAuthor Commented:
I resolved the problem by adding code that checks one of the sessions variables and , if it is blank redirects the user to the login page.  I forgot to close this question and I apologize for that.

Les
0
moduloCommented:
PAQed with points refunded (250)

modulo
Community Support Moderator
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development Software

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.