Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ASP.NET Membership - stop redirection to last page on login.

Posted on 2011-03-23
2
Medium Priority
?
533 Views
Last Modified: 2012-05-11
When using ASP.NET Membership if a user lets his system go idle and the login expires then the next request will force the user to the Login page.  The Url then contains a redirect parameter like this...

http://localhost/CARS/Login.aspx?ReturnUrl=%2fCARS%2fAgreements.aspx

Then when the user logs in again it takes them to the last page they were on.

I can see how this could potentially be a handy feature.  But is there any way to turn it off?
0
Comment
Question by:JosephEricDavis
2 Comments
 
LVL 7

Accepted Solution

by:
nbove earned 2000 total points
ID: 35202884
You cannot override the ReturnURL behavior.  It is integrated into the membership mode.  However, you can work around the behavior.

In your login.aspx page, you can inspect the value of ReturnUrl in the Request.  If it contains a value, then simply redirect to the login page without the return url string.

Here is a code snippet:
      if (!string.IsNullOrEmpty(Request["ReturnUrl"])) {
        Response.Redirect("Login.aspx");
      }

Open in new window

0
 
LVL 7

Author Comment

by:JosephEricDavis
ID: 35202898
Yes, I've already thought about this as a solution.  I'm just surprised that there isn't a built in way to override as it seems like a common enough configuration need.

If anyone else has any input on this I'm going to keep this question open for a while.  Otherwise I'll just award you full points.

Thanks.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question