473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Redirecting a user back to their last page

TG
Hi, I have a question concerning redirecting users who have logged in
using our login page. Once they have properly filled out the form
they should be redirected back to the last page they were viewing. Is
there a way to do this in ASP.NET/VB.NET?

Thanks
TG
Nov 22 '05 #1
4 3807
TG wrote:
Hi, I have a question concerning redirecting users who have logged in
using our login page. Once they have properly filled out the form
they should be redirected back to the last page they were viewing. Is
there a way to do this in ASP.NET/VB.NET?


That's basically how Form Authentication in ASP.NET works. You request some
page foo.aspx, you're redirected to a login page, and after successful
authentication you're being redirected back to foo.aspx.

Cheers,

--
Joerg Jooss
jo*********@gmx.net
Nov 22 '05 #2
Actually I cannot use Forms Authentication at this point in the site so
I just need a simple way to redirect the user back to their last page
after they have filled out the login information. Can this be done?

Thanks

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 22 '05 #3
Hi,

This could be either easy or tough depending on how users are getting to
your login page. Are they clicking a button or clicking a link? If they
are clicking a button that causes a postback and then you redirect this will
be easy. Just create a quick session variable and put in the page that
performed the redirect before you redirect. Then from your login just
assign that Session variable to a string, set that Session variable to
Nothing, and redirect them back. If you are using a hyperlink then I'm not
sure how you would do it. Maybe do a search on Environment variables that
IIS holds, maybe one of those holds the page they came from. Other than
that you'd have to hand code it. Or create a class that inherits
System.Web.UI.Page, add code to the Page_Load of that base class to store
the current page in the session, and then inherit that page whereever you
have a link to the login page. Don't inherit the login page from this.
Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"Terry Graham" <tj*******@hotmail.com> wrote in message
news:uc**************@TK2MSFTNGP11.phx.gbl...
Actually I cannot use Forms Authentication at this point in the site so
I just need a simple way to redirect the user back to their last page
after they have filled out the login information. Can this be done?

Thanks

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 22 '05 #4
Hi Ken,

When a user clicks a link from one page to the next, the HTTP_REFERER header
gets the URL of the referring page. The original poster can easily use that
value to reference where to go back to.

-- Nick

"Ken Dopierala Jr." <kd*********@wi.rr.com> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
Hi,

This could be either easy or tough depending on how users are getting to
your login page. Are they clicking a button or clicking a link? If they
are clicking a button that causes a postback and then you redirect this will be easy. Just create a quick session variable and put in the page that
performed the redirect before you redirect. Then from your login just
assign that Session variable to a string, set that Session variable to
Nothing, and redirect them back. If you are using a hyperlink then I'm not sure how you would do it. Maybe do a search on Environment variables that
IIS holds, maybe one of those holds the page they came from. Other than
that you'd have to hand code it. Or create a class that inherits
System.Web.UI.Page, add code to the Page_Load of that base class to store
the current page in the session, and then inherit that page whereever you
have a link to the login page. Don't inherit the login page from this.
Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"Terry Graham" <tj*******@hotmail.com> wrote in message
news:uc**************@TK2MSFTNGP11.phx.gbl...
Actually I cannot use Forms Authentication at this point in the site so
I just need a simple way to redirect the user back to their last page
after they have filled out the login information. Can this be done?

Thanks

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Nov 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Joshua Beall | last post by:
Hi All, What is the best way to use a cookie to remember a logged in user? Would you store the username and password in two separate cookies? Should the password be plain text? Hashed? Not...
25
by: Rob Tweed | last post by:
Two inter-related questions: If I'm in PHP page a.php, and I want to switch control to page b.php, the only mechanism I've come across is to use header('Location: someURL") ; This has two...
4
by: TG | last post by:
Hi, I have a question concerning redirecting users who have logged in using our login page. Once they have properly filled out the form they should be redirected back to the last page they were...
7
by: jsale | last post by:
I'm currently using ASP.NET with VS2003 and SQL Server 2003. The ASP.NET app i have made is running on IIS v6 and consists of a number of pages that allow the user to read information from the...
9
by: Denise | last post by:
I have posted a similar message in 2 other forums but got no response. I have spent more hours than I can count researching this. Can anyone provide some insight...? Our ASP.Net application...
13
by: Mickey | last post by:
Hi all, Currently I use a timestamp to log users out after 15 minutes of inactivity. However I also need to log a user out if they have just left the page. I need to do this because I store...
41
by: amygdala | last post by:
Hello all, I have posted a similar question in comp.lang.php in the past, but haven't had any response to it then. I kinda swept the problem under the rug since then. But I would really like to...
9
by: Jonathan Wood | last post by:
I've spent days trying to come up with a solution. I'd appreciate it if anyone can help. My site requires all users to log on. There are three different roles of users, and each user type will...
3
pradeepjain
by: pradeepjain | last post by:
hii guys, i am redirecting my website to an error page when it cannot connect to mysql database .because of this the url of the page gets changed to error page url .so the user will...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.