Re: Cache feature doesn't produce expected result (bug?)

Tech-Archive recommends: Fix windows errors by optimizing your registry



re:
> Could it be that you saw this when testing without restarting IE?

I didn't restart IE, thinking that editing the source file would
automatically force recompilation ( and return a new page anyway ).

Let me take a look at it while closing IE, and I'll post back.




Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================

<Tom.PesterDELETETHISSS@xxxxxxxxxx> wrote in message
news:a1a977a22ed738c742f45e90c666@xxxxxxxxxxxxxxxxxxxxx
> Hi Juan,
>
> I tried exactly the steps that you advised but this is where I can't reproduce
>
>>If you set HttpContext.Current.Response.Cache.SetAllowResponseInBrowserHistory(False)
> you'll see that immediately the "This page has expired" message *is* displayed, and the
> client needs to resubmit the >page.
>
> I dont see the "This page has expired" message and if I comment out
> SetAllowResponseInBrowserHistory I get the same result as False is the default. No "This
> page has expired" message, the browser request a new page as I can see by the time.
>
> Could it be that you saw this when testing without restarting IE? I even made a video of
> my clean virtual machine (just SP2 installed) to show you my result.
>
> Please try this:
> http://users.pandora.be/TomPester/ASP/r.rar
>
> Do you realy get a "This page has expired" when you do what's on the video? I don't.
>
> Setting SetAllowResponseInBrowserHistory to true or false... I never see a difference.
>
> Cheers,
> Tom Pester
>
>
>> re:
>>
>>>> You only need to set
>>>> HttpCachePolicy.SetAllowResponseInBrowserHistory when you need to
>>>> set it to true to override the NoCache setting
>>>>
>>> Setting SetAllowResponseInBrowserHistory to True doesn't
>>> touch/override the "no-cache" value. It only removes the expires=-1
>>> header.
>>>
>> Maybe we have a semantics problem here.
>>
>> Removing the expires= -1 header *equals* overriding the "NoCache"
>> value.
>>
>> When HttpCacheability is set to NoCache or ServerAndNoCache the
>> Expires HTTP header is set to -1 by default.
>>
>> NoCache and ServerAndNoCache instruct the client to not cache
>> responses in the History folder by setting that header.
>>
>> This means that each time you use the back/forward buttons, the client
>> requests a new version of the response.
>>
>> When SetAllowResponseInBrowserHistory is set to True, the Expires HTTP
>> header is removed.
>>
>> If you comment out this line :
>> HttpContext.Current.Response.Cache.SetAllowResponseInBrowserHistory(Tr
>> ue) and alternate between clicking the Submit button and the Back
>> button, you'll see that the "This page has expired" message is not
>> displayed.
>>
>> That means that the client *has* requested a new version of the page,
>> without having to resubmit the page.
>>
>> If you set
>> HttpContext.Current.Response.Cache.SetAllowResponseInBrowserHistory(Fa
>> lse) you'll see that immediately the "This page has expired" message
>> *is* displayed, and the client needs to resubmit the page.
>>
>> Now, if you set
>> HttpContext.Current.Response.Cache.SetAllowResponseInBrowserHistory(Tr
>> ue)
>> and alternate between the Submit button and the Back button,
>> you'll see that the "This page has expired" message is not displayed,
>> and the page is displayed without needing to resubmit the page.
>> The documentation is wrong in requesting that you
>> "Click the Submit button a few times".
>> That throws a wrench into the works.
>> You should only hit it once to see the correct behavior.
>> The documentation is also wrong when it states that
>> SetAllowResponseInBrowserHistory allows client-side caching.
>>
>> In effect all it does is remove the need to resubmit the page.
>>
>> I hope this makes this issue clearer.
>>
>> Juan T. Llibre
>> ASP.NET MVP
>> http://asp.net.do/foros/
>> Foros de ASP.NET en Español
>> Ven, y hablemos de ASP.NET...
>> ======================
>> <Tom.PesterDELETETHISSS@xxxxxxxxxx> wrote in message
>> news:a1a977a22e56e8c742966a1df0de@xxxxxxxxxxxxxxxxxxxxx
>>
>>> Hi Juan,
>>>
>>> Thanks for your response.
>>>
>>>> You only need to set
>>>> HttpCachePolicy.SetAllowResponseInBrowserHistory when you need to
>>>> set it to true to override the NoCache setting
>>>>
>>> Setting SetAllowResponseInBrowserHistory to True doesn't
>>> touch/override the "no-cache" value. It only removes the expires=-1
>>> header.
>>>
>>> This code shows this :
>>> Response.Cache.SetCacheability(HttpCacheability.NoCache)
>>> Response.Cache.SetAllowResponseInBrowserHistory(True)
>>>
>>> The servers send the following cache related headers :
>>> 'Cache-Control: no-cache
>>> 'Pragma: no - Cache
>>> I don't know if you are experienced in http headers and their
>>> behavior but could you please test the code that's on this page and
>>> report your result? :
>>>
>>> http://msdn2.microsoft.com/library/97wcd0a4(en-us,vs.80).aspx
>>>
>>> If you run the sample and go back with your browser I think you will
>>> find that the text on the page is wrong.
>>>
>>> Thanks in advance, Tom
>>>
>
>


.


Quantcast