NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Robert Iliuta on March 02, 2011, 01:09:56 AM

Title: Conditional NO-CACHE option fro dynamic or static pages
Post by: Robert Iliuta on March 02, 2011, 01:09:56 AM
Hallo,


I want for some dynamic pages to have the option NO-CACHE on. How can I do this? If I set in ProcessLink self.ForceNoCache = 1 then all site is NO-CACHE. And this is not good will run very slowly.... I would like just some pages. How can I do this?

My problem is that I have a browse where customers have photos. If the customer change an existing photo it will not refresh and show the current one. They need to CTRL+F5 or worst close and open again the browser or they need to go and delete manual the cache...
I want to avoid this by NO-CACHE option ...

Thank you for any suggestions

Robert
Title: Re: Conditional NO-CACHE option fro dynamic or static pages
Post by: Bruce on March 02, 2011, 10:22:00 PM
All dynamic pages have noCache on by default.

But you're not talking about dynamic pages, you're talking about images, which I suspect you're storing on the disk. These are static files, not dynamic ones.

If you wish to make some static files no-cache, then you need to set self.ForceNoCache, but on a selective basis. ie test the self.RequestFileName property first. In order not to clash with the static images, which are in the images folder, I recommend putting dynamic images in some other folder, and testing for that folder name in the request.

Bear in mind that when you include an image in a browse, all the browse generates is the <img> tag. The browser then fetches the image as a separate request, and hence on a separate thread, so this code goes in the WebHandler, not in the browse.

Cheers
Bruce
Title: Re: Conditional NO-CACHE option fro dynamic or static pages
Post by: Robert Iliuta on March 03, 2011, 12:26:41 AM
Hallo Bruce,

My images are stored in web\poze\ folder.
I test like this:

! WebHandler \ ProcessLink \ before parent

IF INSTRING('\poze\',clip(self.RequestFileName),1,1)
    self.ForceNoCache = 1
END

also I put the name of the form and browse with NO-CACHE and it works 99% :-) . In Chrome it works perfect. In Safari and Firefox i need to call again the browse than it's ok. Can I refresh some how the browse? and not from menu?

Thank you very much for help,

Robert