Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - How to use Response.Redirct like a browser back button?

 
Thread Tools Search this Thread
Old 08-22-2003, 09:29 PM   #1
Default How to use Response.Redirct like a browser back button?


What is the difference between the two?

I have a page "one" with a button using Response.Redirect("pagetwo.asxp") to
go to the next page.

On page two I have a button using Response.Redirect("pageone.aspx") to go
back to page one.

When I view page one, select some information, then go to page two, and then
select the back button (using the response.redirect) none of my selections
remain. If I just use the back button of the web browser everything works
fine.

Anything I am doing wrong?

Thanks.




Michelle A.
  Reply With Quote
Old 08-22-2003, 10:41 PM   #2
Steve C. Orr, MCSD
 
Posts: n/a
Default Re: How to use Response.Redirct like a browser back button?
Kevin is right.
To get it to work like the back button, Instead of using Response.Redirect
to go back to page one you could execute some client side javascript like
this:
history.go(-1);

So you could have a "Back" anchor tag in your HTML that looks like this:
<a href='javascript:history.go(-1);'>Back</a>

Here's more info:
http://www.devguru.com/Technologies/...istory_go.html

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com



"Michelle A." <> wrote in message
news:...
> What is the difference between the two?
>
> I have a page "one" with a button using Response.Redirect("pagetwo.asxp")

to
> go to the next page.
>
> On page two I have a button using Response.Redirect("pageone.aspx") to go
> back to page one.
>
> When I view page one, select some information, then go to page two, and

then
> select the back button (using the response.redirect) none of my selections
> remain. If I just use the back button of the web browser everything works
> fine.
>
> Anything I am doing wrong?
>
> Thanks.
>
>





Steve C. Orr, MCSD
  Reply With Quote
Old 08-22-2003, 10:47 PM   #3
Kevin Spencer
 
Posts: n/a
Default Re: How to use Response.Redirct like a browser back button?
One caution about using JavaScript history, though: With ASP.Net it can have
unexpected results, as ASP.Net WebForms submit to themselves, and have
different ViewState data in them at different times.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
The more I learn, the less I know.

"Steve C. Orr, MCSD" <> wrote in message
news:...
> Kevin is right.
> To get it to work like the back button, Instead of using Response.Redirect
> to go back to page one you could execute some client side javascript like
> this:
> history.go(-1);
>
> So you could have a "Back" anchor tag in your HTML that looks like this:
> <a href='javascript:history.go(-1);'>Back</a>
>
> Here's more info:
> http://www.devguru.com/Technologies/...istory_go.html
>
> --
> I hope this helps,
> Steve C. Orr, MCSD
> http://Steve.Orr.net
> Hire top-notch developers at http://www.able-consulting.com
>
>
>
> "Michelle A." <> wrote in message
> news:...
> > What is the difference between the two?
> >
> > I have a page "one" with a button using

Response.Redirect("pagetwo.asxp")
> to
> > go to the next page.
> >
> > On page two I have a button using Response.Redirect("pageone.aspx") to

go
> > back to page one.
> >
> > When I view page one, select some information, then go to page two, and

> then
> > select the back button (using the response.redirect) none of my

selections
> > remain. If I just use the back button of the web browser everything

works
> > fine.
> >
> > Anything I am doing wrong?
> >
> > Thanks.
> >
> >

>
>





Kevin Spencer
  Reply With Quote
Old 08-22-2003, 10:50 PM   #4
Michelle A.
 
Posts: n/a
Default Re: How to use Response.Redirct like a browser back button?
Cool..

I will take a look at that on Monday..

Thanks.


"Steve C. Orr, MCSD" <> wrote in message
news:...
> Kevin is right.
> To get it to work like the back button, Instead of using Response.Redirect
> to go back to page one you could execute some client side javascript like
> this:
> history.go(-1);
>
> So you could have a "Back" anchor tag in your HTML that looks like this:
> <a href='javascript:history.go(-1);'>Back</a>
>
> Here's more info:
> http://www.devguru.com/Technologies/...istory_go.html
>
> --
> I hope this helps,
> Steve C. Orr, MCSD
> http://Steve.Orr.net
> Hire top-notch developers at http://www.able-consulting.com
>
>
>
> "Michelle A." <> wrote in message
> news:...
> > What is the difference between the two?
> >
> > I have a page "one" with a button using

Response.Redirect("pagetwo.asxp")
> to
> > go to the next page.
> >
> > On page two I have a button using Response.Redirect("pageone.aspx") to

go
> > back to page one.
> >
> > When I view page one, select some information, then go to page two, and

> then
> > select the back button (using the response.redirect) none of my

selections
> > remain. If I just use the back button of the web browser everything

works
> > fine.
> >
> > Anything I am doing wrong?
> >
> > Thanks.
> >
> >

>
>





Michelle A.
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Disabling Back Button and Refresh Buttons tessythampan Software 1 12-18-2007 09:13 PM
Back button doesn't work when it is a secure page returning to a non secure page Miss Mary General Help Related Topics 1 09-21-2007 10:32 AM
Re: Faulty PC power button WinXP_Powered A+ Certification 5 03-09-2006 07:51 AM
Re: Faulty PC power button Christopher Range A+ Certification 0 02-25-2006 12:02 AM
New releases: Fox two pack blitz, WB 3 packs: Updated complete downloadable R1 DVD DB & info lists Doug MacLean DVD Video 0 08-19-2003 05:39 AM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46