Solved

Redirect back to last page

Posted on 2011-09-12
12
182 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
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.

778 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