Solved

Back to previous page after login redirect

Posted on 2010-09-05
4
693 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
  • 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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

707 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now