Hard copying dynamic output, baby.

Results 1 to 2 of 2

Thread: Hard copying dynamic output, baby.

  1. #1
    Join Date
    Dec 1969

    Default Hard copying dynamic output, baby.

    &nbsp;<BR>OK, so IIS churns out the relevant HTML when for example a query is made to a database and the dynamic page is created. But is there any relatively straight forward way you know that the outputted HTML for that instance in time (i.e. the instant that query was made) can be saved as a seperate HTML file in it&#039s own right.<BR><BR>I can think of some funky applications if it is possible.<BR><BR>Kind regards, best wishes, li&#039l kisses, etc.

  2. #2
    Join Date
    Dec 1969

    Default RE: Hard copying dynamic output, baby.

    This has been my life lately...baby<BR>I do this using the Scripting.FileSystemObject as in<BR>CreateObject("Scripting.FileSystemObject"). I wrote a function which I pass an array and filename that I want to be the output. It does the grunt work of writing the HTML file based on the data in the array to a subdirectory set up as a virtual on my site. When it is done, it saves the file (the filename passed to it and .htm).<BR><BR>So, your asp that goes against the database could get your results back and pack what you need into an array (or you could pas the recordset i guess). Call the "page writing" function and wait for the page to be written. Here is an example. You will need to use response.buffer=true for the redirect to work.<BR><BR>do all your database calls<BR>pack the array (could be multi-dimensional)<BR>filename = (some unique name)<BR>call page_writer(filename, mydataarray) &#039make the page<BR> <BR>Set fso = CreateObject("Scripting.FileSystemObject")<BR>Do while not (fso.FileExists(filename& ".htm")) <BR>LOOP &#039 wait for it to exist<BR>set fso=nothing<BR>response.redirect("http://mysite.com/myvirtualpath/"& filename & ".htm")<BR><BR>Now you have your "permanent" results page. The details are in the page_writer function. Only you know what you want the page to look like. Also, I (and you) should add a time-out to the loop incase the page never gets created. My actual process is more complicated as I have dynamic charts also being created by a COM object but the theory is the same. You will need to come up with unique filenames as well as a way to clean out old files. I wrote a routine to delete files older than 24 hrs from my directory on every session_onstart. But it could be days not 24 hours if I wanted.<BR><BR>The reason I used a virtual directory is because I use Interdev to create/edit the site and I don&#039t want it keeping track of all those files.<BR><BR>Where&#039s my kisses ? (boy I hope Aftab is a female name ! gulp!)<BR>(hit me at adobeman@ntplx.net if you want some real examples)<BR><BR>Mike<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