[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.caching

Stop browser and server caching

steven scaife

10/10/2006 8:32:00 AM

A quick question, I am trying to get a page in a site i am developing to stop
caching I have tried adding the OutPutCache Location="none" tag to the page
and the HTML tags that handle browser caching but these don't work as
expected.

I have a page where they click on a product from the navigational menu, it
then stores the dataset in a session variable because some products have more
than 5 products so a paging routine is implemented, however if they use there
back button onthe browser and look at a previous product they have clicked on
then the session variable has been overwritten by the current product they
looked at. If there is only one page for the current product but 5 pages for
the previous product then it errors because the currentpageindex is greater
than the pagecount, if there is more than one page then it pages through the
wrong set of products. I need to stop them from being able to look at the
previous product, i am assuming that if the page shows a message that the
content is no longer valid and they refresh the content it should pull the
right data through, it passes the product ID through the querystring so it
should be able to find the right data.

The only thing i can think of is javascript to clear the history when the
user views a product page, the only problem with this is a lot of web users
don't like that and I want to make the user experience as friendly as
possible.

thanks in advance for any suggestions
1 Answer

offwhite

10/10/2006 9:29:00 PM

0

It appears you are mixing 2 problems.

You can disable OutputCache by simply removing the directive from your
page. What I normally do is place the content which can be cached into
User Controls (.ascx) with an OutputCache directive while the pages
(.aspx) hold them are not cached.

Your other problem is trying to control history and back button. That
is something many web developers have failed to do because it is not
meant to be done. You will not be able to reliably prevent someone
from using their back button to get to a previous page.

You have to make the decision on whether you are building a "web site"
or a "web application." If you are building the application you may
want pop a fresh window with no navigational controls and handle all
navigation through your own means. Such an approach is hardly
reasonable for the average web user who will be uneasy about missing
their back and forward buttons.

Here is a good overview of the problem.

http://ajaxian.com/archives/handling-usability-concerns-such-as-the-back-button-and-b...

Brennan Stehling
http://brennan.offwhite...

steven scaife wrote:
> A quick question, I am trying to get a page in a site i am developing to stop
> caching I have tried adding the OutPutCache Location="none" tag to the page
> and the HTML tags that handle browser caching but these don't work as
> expected.
>
> I have a page where they click on a product from the navigational menu, it
> then stores the dataset in a session variable because some products have more
> than 5 products so a paging routine is implemented, however if they use there
> back button onthe browser and look at a previous product they have clicked on
> then the session variable has been overwritten by the current product they
> looked at. If there is only one page for the current product but 5 pages for
> the previous product then it errors because the currentpageindex is greater
> than the pagecount, if there is more than one page then it pages through the
> wrong set of products. I need to stop them from being able to look at the
> previous product, i am assuming that if the page shows a message that the
> content is no longer valid and they refresh the content it should pull the
> right data through, it passes the product ID through the querystring so it
> should be able to find the right data.
>
> The only thing i can think of is javascript to clear the history when the
> user views a product page, the only problem with this is a lot of web users
> don't like that and I want to make the user experience as friendly as
> possible.
>
> thanks in advance for any suggestions