Connecting Tech Pros Worldwide Help | Site Map

Redirecting a user back to their last page

  #1  
Old November 22nd, 2005, 02:40 PM
TG
Guest
 
Posts: n/a
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
  #2  
Old November 22nd, 2005, 02:40 PM
Joerg Jooss
Guest
 
Posts: n/a

re: Redirecting a user back to their last page


TG wrote:[color=blue]
> 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?[/color]

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
joerg.jooss@gmx.net


  #3  
Old November 22nd, 2005, 02:40 PM
Terry Graham
Guest
 
Posts: n/a

re: Redirecting a user back to their last page


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!
  #4  
Old November 22nd, 2005, 02:41 PM
Ken Dopierala Jr.
Guest
 
Posts: n/a

re: Redirecting a user back to their last page


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" <tjgraham4@hotmail.com> wrote in message
news:uc6ya39pEHA.2764@TK2MSFTNGP11.phx.gbl...[color=blue]
> 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![/color]


  #5  
Old November 22nd, 2005, 02:42 PM
Nick Malik
Guest
 
Posts: n/a

re: Redirecting a user back to their last page


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." <kdopierala2@wi.rr.com> wrote in message
news:%23HzT7KDqEHA.324@TK2MSFTNGP11.phx.gbl...[color=blue]
> 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[/color]
will[color=blue]
> 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[/color]
not[color=blue]
> 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" <tjgraham4@hotmail.com> wrote in message
> news:uc6ya39pEHA.2764@TK2MSFTNGP11.phx.gbl...[color=green]
> > 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![/color]
>
>[/color]


Closed Thread