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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Force Refresh of ASP Page. No Cache

Status
Not open for further replies.

Creeder

Programmer
Jul 5, 2000
110
MY
Hi All,

I have tried the out the solution as suggested in the FAQ but the page is still cache (when press back button) the page still shows the old information.

I used the following method
*code take from faq

<%@ Language=VBScript %>
<% Option Explicit %>
<%
dim uUrl
uUrl = &quot;uUrl=&quot; & Date & Timer
%>

<a href = &quot;somepage.asp?<%=uUrl%>>Test</A>


but pressing the back button does not refresh the page. I am missing something here? Any help is greatly appreciated :)
 
Hi

It is nearly impossible to make a page which has been stored in a users history to refresh when using the back button - unfortunately - it only workes when you go to a new page using a hyperlink! Check out his thread

thread333-227368 Derren
[The only person in the world to like Word]
 
Hi

It is nearly impossible to make a page which has been stored in a users history to refresh when using the back button - unfortunately - it only works when you go to a new page using a hyperlink. Check out his thread

thread333-227368 Derren
[The only person in the world to like Word]
 
It's very possible. Here's how:

faq333-1034

:)
paul
penny1.gif
penny1.gif
 
Paul and Derren,

Thanks for your reply. Unfortunately this is reagarding the faq. I am using the second method as suggested by the faq. However it's still not working.

Any suggestion

thanks.

YJ
 
Hi paul

Thanks for the input, I wholeheartedly agree that you can force the refresh of a page, and this is a technique I have used successfully for a while. However, I think that YJ is after a different answer.

If you use the
Code:
<%=now()%>
in a link it will always give you a new, un-cached page because the browser thinks it is another, different page BUT ONLY if you go to that page by following a hyperlink (or a response.redirect). This method will only work if you &quot;pull&quot; the page from the web server with a request.

When you use the back button you are not requesting the page again, you are simply looking at the shadow of the previous page so it will always look the same as it has not communicated with the web server for a fresh set of data.

Further, if the URL of the page (for example) was

Code:
cachedpage.asp?fake=03062002103045

and if you went back to that page using the back button or a javascript:history.back() you would go back to the same URL, and the browser would assume that this was a page it had already been to, circumventing our fabulous getaround.
Derren
[The only person in the world to like Word]
 
If you put in the body tag <body onload='someFunction()'>, then even when going back in the history using the back button, it should still fire up that function. Now, if in that function you have some javascript that reloads/refreshes the page, then it should always give you the newest (uncached) page, even when going back in your history of your browser.

Am I wrong? -Ovatvvon :-Q
 
mmmm... could work, yes. but post data and things of that nature would cause the &quot;Re-post?&quot; dialog box. You know the one.

However, if you construct a noCache include file, as is in the first part of the FAQ, then when you hit back, the user gets the &quot;Warning: Page has expired&quot; thing where they have to hit refresh to refresh the page, thereby grabbing a fresh load of the page.

Couple that with the method in the second half of the FAQ, and I haven't yet found a situation where caching is a problem.
penny1.gif
penny1.gif
 
The only problem with the no-cache presenting the &quot;Warning: Page has expired&quot; page....I've seen and experienced about 95% of users see that page and think that the web site just doesn't work anymore and they have to re-open a new browser and start again....most users don't actually read error messages.

However, you may also be right about the fact of reloading post data. It probably will present the msg box asking if you want to 'retry' or to 'cancel'. That is the best option I can see though...I think most people would probably hit the retry button and then it'd be reloaded. However, most I've seen just close the browser or move on to another web page when they encounter the other white 'expired' page.

Just a some thoughts. -Ovatvvon :-Q
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top