Solved

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

Posted on 2011-03-23
2
530 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Accepted Solution

by:
nbove earned 500 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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

628 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