473,320 Members | 1,965 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,320 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 3803
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.