Solved

asp.net + previous page before postback

Posted on 2004-08-18
3
436 Views
Last Modified: 2012-06-21
i have a page that i am using for the user to sign into the site, what i want to do is after they have signed in, it will redirect them back to the page they just came from.  The problem i get the page they came from, but once they click sign in button the page postbacks and then i get the url for the page they are currently on.  how can i get and use the page before the postback happens

i tired using backpage = Page.Request.UrlReferrer  but as i said as soon as they click sign in button page postback and lose the actual page they had come from

Thanks
0
Comment
Question by:dkilby
  • 2
3 Comments
 
LVL 28

Expert Comment

by:mmarinov
Comment Utility
Hi,

you can use the forms authentication and then when the user is not authorized he/she is redirected to the login page with a value within the querystring that keep the referrer. then you can use FormsAuthentication.RedirectFromLoginPage method which ( as describes in MSDN ) : Redirects an authenticated user back to the originally requested URL.



Regards,
B..M
0
 
LVL 21

Expert Comment

by:tovvenki
Comment Utility
Hi,
one another way is to save the value of Page.Request.UrlReferrer  in session and use the value in the session when you want to redirect to the page that they came from. Because without saving the value if the user postbacks then the value of Page.Request.UrlReferrer will change so you can't redirect the user to the page they came from.

Regards,
venki
0
 
LVL 21

Accepted Solution

by:
tovvenki earned 500 total points
Comment Utility
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Hangfire / asp.net sample 3 27
Duplicate a row 2 28
Problem to go to Web page 2 46
Trouble with References... 5 21
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…
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…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

762 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

6 Experts available now in Live!

Get 1:1 Help Now