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.
ASP.NET

Avatar of undefined
Last Comment
M.L. Martin
ASKER CERTIFIED SOLUTION
Avatar of Kumaraswamy R
Kumaraswamy R
Flag of India image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of strickdd
strickdd
Flag of United States of America image

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
M.L. Martin
Flag of United States of America image

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.
ASP.NET
ASP.NET

The successor to Active Server Pages, ASP.NET websites utilize the .NET framework to produce dynamic, data and content-driven web applications and services. ASP.NET code can be written using any .NET supported language. As of 2009, ASP.NET can also apply the Model-View-Controller (MVC) pattern to web applications

128K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo