Caching a page

J

joethis

Is there a way to cache an ASP page on the servers memory for a certain amount of time?
 
A

Aaron Bertrand - MVP

Create an HTML page as output, and then replace it when your "cache" expires
(however you determine that)...

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/




joethis said:
Is there a way to cache an ASP page on the servers memory for a certain
amount of time?
 
M

Michael D. Kersey

joethis said:
Is there a way to cache an ASP page on the servers memory for a certain amount of time?
ASP pages _are_ cached on the server:
the first time an ASP page is requested, the source code is collected
(and cached), then compiled to bytecode and executed (and the bytecode
cached). See the details in Appendix 3 of
http://www.microsoft.com/technet/pr...ptimize/iis5tune.mspx#XSLTsection130121120120

Perhaps you wish to cache the _output_ of the ASP page (i.e., the HTML
that is produced by execution of that ASP page)? To do that, create a
program that writes the output to a .htm or .html file.
 
A

Aaron Bertrand [MVP]

Well, you have an ASP page that you are running that does this, right?

response.write "<html>"
response.write "<body>"
response.write "Here is some content..."
....

So, instead, you do this:

set fso = CreateObject("Scripting.FileSystemObject")
set fil = fso.CreateTextFile(Server.MapPath("cache.htm"), true)
fil.writeline "<html>"
fil.writeline "<body>"
fil.writeline "Here is some content..."
fil.close
set fil = nothing: set fso = nothing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top