?
Solved

Redirect back to last page

Posted on 2011-09-12
12
Medium Priority
?
190 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 375 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

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…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses
Course of the Month14 days, 1 hour left to enroll

807 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