Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I refresh page one when using the back button on my mouse

Status
Not open for further replies.

jazzz

Technical User
Feb 17, 2000
433
US
First, thanks for looking at this it is appreciated.

Here is what I have and what I would like see happen.

I have two ASP pages, page one the user selects criteria via a form. Upon clicking submit they are directed to page two where we search the db using their criteria with the results, if any, displayed on page two.

If no matches are found we return them to page one where we display the appropriate message based on a querystring that we attach to our redirection. Example: Server.Execute("models_searchengine.asp?Action=NoMatch")

Everything works as planned except when the user gets a match after they previously didn’t have a match on page two. If they click the back button on either their mouse or browser it returns them back to page one with the above url, which in turn displays our nomatch error when in reality they have a match.

What I like to do is clear that buffer or cache that is storing the previous url when there is a match on page two, OR better yet every time I hit page two clear it at the very top of the page. Then if there is a problem return them to page one with the correct querystring. Is this possible? If so how do I remove that stored url when they hit page two?

Another solution would be a different way to handle the return to page one and how I display the error message. Anyone have a suggestion?

Bottom line I need to clear the Querystring Error so if they use the back button no message appears when they have a match.

Thanks Again


Life's a journey enjoy the ride...

jazzz
 
put these 3 lines on the top of your asp page:

<% Response.CacheControl = "no-cache" %>>
<% Response.AddHeader "Pragma", "no-cache" %>
<% Response.Expires = -1 %>

-DNG
 
Doesn't work, I tried it but thank you.

Life's a journey enjoy the ride...

jazzz
 
if that doesnt work we can work on another alternative that deals with using javascript close popup that will redirect to the page1 when no records are found.

-DNG
 
DNG, your assumption is 100% correct. Can I clear the HTTP Refer when I enter page two? Then based on the results return them to page one wit the proper querystring.

Life's a journey enjoy the ride...

jazzz
 
yes tweak with the below syntax and change it to whatever you want...

if instr(Request.ServerVariables("HTTP_Referer"),'page2.asp') > 0 then
response.redirect "End if

if you find it difficult...show us your page transitions with some dummy links as i have shown and then we can make it work...

-DNG
 
DNG, thanks for the help but I give up. I can't clear the URL from the referer unless I click on our created link. My pages are as follows search.asp searchprocessor.asp but the problem is I use page two to show the results and I don't need or want to redirect if I have a match so how do I clear the referer. I can post the links to the page or email them to you if you like I don't want to overstep my bounds on the site by posting anything I shouldn't.

The problem is when I return to page one and run my sub checking on the querystring from page two it displays a message. Therefore if the user just hits the back button it contains the previous querystring.

Life's a journey enjoy the ride...

jazzz
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top