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
Solved

Redirect back to last page

Posted on 2011-09-12
12
183 Views
Last Modified: 2012-05-12
If a user goes to the page demos.aspx, but they are not logged in, they are sent to the login.aspx page.  Once they have logged in, I want to sent them back to the page they were at.
Is there some function build into .NET that will do this?
0
Comment
Question by:rrhandle8
  • 7
  • 3
  • 2
12 Comments
 
LVL 20

Expert Comment

by:Daniel Van Der Werken
ID: 36525149
I think this solution will work for what you're looking to do:
http://geekswithblogs.net/ranganh/archive/2005/04/25/37612.aspx

Here is the information on RedirectFromLoginPage():
http://msdn.microsoft.com/en-us/library/1f5z1yty.aspx
0
 

Author Comment

by:rrhandle8
ID: 36525346
Dan7el,

The code you sent me to at geekswighblogs makes me suspicious.  Why would I need to username?  Maybe I should state that I am not using .NET membership and roles.  This is a custom login.
0
 
LVL 20

Expert Comment

by:Daniel Van Der Werken
ID: 36525423
Are you using Forms Authentication?  You can use custom memberships and roles with forms auth.
0
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.

 

Author Comment

by:rrhandle8
ID: 36525635
I am not using memberships and roles.  Client insisted I not use them.  So this is all custom programming for the login.
0
 

Author Comment

by:rrhandle8
ID: 36525780
Couldn't this be done with something like Request.ServerVariables("HTTP_REFERER")
0
 
LVL 12

Expert Comment

by:Ramkisan Jagtap
ID: 36528833
Hi
Whenever you are redirecting to the Login page, you can send the page url in QueryString then after login redirect to that page again.

Regards,
Ram
0
 

Author Comment

by:rrhandle8
ID: 36530286
ramkisan, There are a lot of pages.  That means I would have to update all of them.
0
 
LVL 12

Expert Comment

by:Ramkisan Jagtap
ID: 36533968
You can only check in Master page for Authentication and tyen redirect from the Master page only!!

Regards,
Ramkisan
0
 

Author Comment

by:rrhandle8
ID: 36534046
Here is the answer.  I found it on another site.

            Dim fromURL As String = Request.ServerVariables("url")
            Response.Redirect("~/FT_Login.aspx?FromURL=" & fromURL)
0
 
LVL 12

Accepted Solution

by:
Ramkisan Jagtap earned 125 total points
ID: 36534050
This is what I have suggested!!! You can read my comments again :)

Regards,
Ramkisan
0
 

Author Comment

by:rrhandle8
ID: 36540020
ramkisan:
OK, if you say so.  What I was look for was the Request.ServerVariables("url") statement.
0
 

Author Closing Comment

by:rrhandle8
ID: 36540022
Should have been clearer in his explanation.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
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.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

840 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