Link to home
Start Free TrialLog in
Avatar of M.L. Martin
M.L. MartinFlag for United States of America

asked on

Direct user to specific login page after session times out

I have a few pages that require users to login to use. When their session times out I want them to be directed to another login screen other than the standard one I have at the root which is login.aspx. I want them to be directed to mobile/Default.aspx which also has a login screen. It seems I should be able to do this in the WebConfig but I don't know the syntax if in fact it is possible. I tried the following but it is wrong.

<location path="m_search.aspx">
<authentication mode="Forms">
  <forms loginUrl="login.aspx"
    defaultUrl="mobile/Default.aspx" />
</authentication>

<authorization>
      <deny users="*"/>
    </authorization>
</location>

I am running ASP.Net 4 for VB....not c#

If you can help please provide the code.
ASKER CERTIFIED SOLUTION
Avatar of Kumaraswamy R
Kumaraswamy R
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
The problem is, when a session times out, you have no session variables to check to see if the user ever was logged in. You will need to create a cookie and check it to make sure that they were once logged in and then do the redirect based on that.
Avatar of M.L. Martin

ASKER

The pages are not allowed to be viewed without logging in so if they are using them they would have been logged in. However, the session does timeout eventually and when they attempt to use the page again I want to use a login other than the default login.aspx.