Direct user to specific login page after session times out

derrekdeveloper
derrekdeveloper used Ask the Experts™
on
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.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
in the web.config - hope it helps.

<authentication mode="Forms">
<forms name=".ASPXFORMSauth" loginUrl="~/Login.aspx"
defaultUrl="~/mobile/Default.aspx" protection="All">

</forms>
</authentication>

<!--Deny anonymous users -->
<authorization>

<deny users="?" />
</authorization>

Commented:
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.
derrekdeveloperEnterprise Solution Architect

Author

Commented:
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.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial