Solved

Redirect back to last page

Posted on 2011-09-12
12
180 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 19

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 19

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
 

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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 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

20 Experts available now in Live!

Get 1:1 Help Now