Preventing the Caching of virtual include file in

Results 1 to 2 of 2

Thread: Preventing the Caching of virtual include file in

  1. #1
    Frank Bailey Guest

    Default Preventing the Caching of virtual include file in

    I&#039m doing a virtual include of an ASP file that reads a line of data from a text file on the server&#039s filesystem and displays it on the homepage of my website. However, it seems that the ASP include is being cached, or perhaps the filesystem reads are being cached. The result is that the exchange rate information I&#039m displaying on my homepage, and is pulled down from another server into the abovementioned textfile, is being cached and therefore does not change.<BR><BR>Response.expires = 0 does not work if put on the homepage, and causes one of those nice "the headers have already been written to the browser" errors if I stick it in the included ASP (but that&#039s pretty obvious).<BR><BR>My question is essentially whether there is any way to stop the input from the filesystem from being cached, so that the information displayed is always as fresh as possible?<BR><BR>Here&#039s what I&#039m doing:<BR><BR>On the Homepage, the include statement:<BR>&#060;!--#include virtual="ex.asp" --&#062;<BR><BR>The file being included:<BR>&#060;%<BR> Dim fso, f1, ts, s<BR> Const ForReading = 1<BR> Set fso = CreateObject("Scripting.FileSystemObject")<BR> Set ts = fso.OpenTextFile("c: estfile.txt", ForReading)<BR> s = ts.ReadLine<BR> Response.Write(s)<BR> ts.Close<BR>%&#062; <BR><BR>The contents of testfile.txt:<BR>$ = R7.68<BR>£ = R11.32<BR><BR>I hope this is enough to go on.<BR><BR>Thanks in advance for any help you&#039re able to offer.<BR>

  2. #2
    PratQ Guest

    Default RE: there may be a better way....

    ... it seems I heard there was a simple way to disable a single page cache using ASP, and perhaps someone else knows it. Anyway, heres a way that might work for you.<BR><BR>There is a way you can use IIS to disable cacheing of any file in a particular directory. It was designed for MIME type files (pics, etc) that change frequently. I dont know why it wouldnt work also for your text file. The howto is in the following KB article. Good luck, let us know if it works for you.<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts