473,395 Members | 1,937 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,395 software developers and data experts.

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.
Nov 17 '05 #1
3 4126
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." <me@me.com> wrote in message
news:OH**************@TK2MSFTNGP09.phx.gbl...
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.

Nov 17 '05 #2
Cool..

I will take a look at that on Monday..

Thanks.
"Steve C. Orr, MCSD" <St***@Orr.net> wrote in message
news:uJ**************@TK2MSFTNGP09.phx.gbl...
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." <me@me.com> wrote in message
news:OH**************@TK2MSFTNGP09.phx.gbl...
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.


Nov 17 '05 #3
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" <St***@Orr.net> wrote in message
news:uJ**************@TK2MSFTNGP09.phx.gbl...
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." <me@me.com> wrote in message
news:OH**************@TK2MSFTNGP09.phx.gbl...
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.


Nov 17 '05 #4

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

Similar topics

1
by: Jenny | last post by:
Need urgent help for an unsolved problem. In our ASP web application, we creat a Back button and if user click on this button, it execute history.go(-1) to go back to the previous page. All our...
4
by: Harsh Thakur | last post by:
Hi, I'd like to know the performance related differences between Response.Redirect and Server.Transfer. I'd like to redirect the user to a different page. I can either do a...
3
by: MarkMurphy | last post by:
I have a simple export.aspx page that allows a user to fill in a form to export some data. The postback logic writes the data to the response stream. I have two small issues: 1) The data is...
11
by: Russ | last post by:
My web app writes some binary data to a file at the client site via Response.Write and Response.BinaryWrite. This action is accomplished in response to a button click, with C# code behind as...
5
by: Jim in Arizona | last post by:
I have a site that uses frames. I made an aspx form with an asp:button control with Onclick=test. The test sub is: Sub Test(ByVal sender As Object, ByVal e As System.EventArgs) ...
6
by: john | last post by:
The standard method to transmit a file from an aspx page to a browser is to stream the file to the response then end the response. The HTML code generated by the aspx page is discarded, and the...
5
by: venner | last post by:
I'm having an issue with an ASP.NET website after upgrading to ASP.NET 2.0. The website makes use of a central authentication service (CAS) provided at the university I work for. Each page checks...
11
by: Paul Furman | last post by:
I'm setting up credit card payment through authorize.net and they have the option to send a POST string back to my site once complete. I'm not sure how to proceed. They don't have much to read...
1
by: waqasahmd | last post by:
Hi, i have a signup.aspx page on which the user get registered and response.redirect to the nextpage.aspx On the nextpage.aspx there is a back button on which has on click event protected...
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.