Solved

Redirect back to last page

Posted on 2011-09-12
12
185 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
[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
  • 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

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 …
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…
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.…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

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