Solved

Back to previous page after login redirect

Posted on 2010-09-05
4
700 Views
Last Modified: 2012-05-10
I want to be able to do the following, any ideas.

User logins into the site and they are redirect to their account details page automatically on successful login. On the account details page though I want to have a back button which will take them back (and refreshed to pick up new stuff because they are logged in) to the page they where on when they clicked Login in the banner.

So this is what currenlty happens;

1. User is on any page in the site, they click on login in the banner and they go to the login page
2. On the login page if they successfully login they are redirect to their account details page
3.On the account details page i want to have a back button which will take the user back to whatever page they where on when they clicked on login in the banner

any ideas?
0
Comment
Question by:AWSHelpdesk
[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
4 Comments
 
LVL 21

Accepted Solution

by:
Dale Burrell earned 167 total points
ID: 33608740
Pass the URL of the page they are on when they click login through as a querystring parameter.
0
 
LVL 82

Assisted Solution

by:leakim971
leakim971 earned 167 total points
ID: 33608745
>1. User is on any page in the site, they click on login in the banner and they go to the login page

set onclick event of the button to record/save the current page before going to the login page.

save it on client side :
- cookie, hidden input, ajax (not a good idea)
create a cookie with js : http://www.w3schools.com/JS/js_cookies.asp

save it on the server side :
 the referer : http://www.beansoftware.com/ASP.NET-FAQ/Referrer-URL.aspx
store it :
- cookie : http://msdn.microsoft.com/en-us/library/system.web.httpresponse.cookies.aspx
-  in a control (hidden) or session variable : http://codeforeternity.com/blogs/technology/archive/2007/12/19/handling-asp-net-session-variables-efficiently.aspx
0
 
LVL 14

Assisted Solution

by:robasta
robasta earned 166 total points
ID: 33609021
www.yoursite.com/originalpage.aspx

When the user clicks login - 'originalpage.aspx' will be appended to the querystring. it will be something like:

www.yoursite.com/login.aspx?ReturnUrl=originalpage.aspx

get the ReturnUrl query string and pass it to the account details page so that it becomes

www.yoursite.com/myaccount.aspx?ReturnUrl=originalpage.aspx....

then get the ReturnUrl and add it as the link for the back button.
0
 
LVL 82

Expert Comment

by:leakim971
ID: 33764025
Thanks for the points!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

726 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