Speed up your ASP pages: Turn Them into HTML with ASPTear!, Part 3
By Evagoras Charalambous
In Part 2 we looked at saving the ASP page's output to an HTML file using
the FileSystemObject, and in Part 1 we looked at obtaining
the ASP page's output using ASPTear. In this, the third and final part, we'll examine how to tie the first
two parts together. At the conclusion of this part we'll have our working, high-performance ASP cache engine
ready to go!
Part 3: Putting it all together
There are many ways and reasons to use transactions for our processing page. The main one is to maintain
application integrity, in other words it's an all or nothing deal. Either everything will commit or nothing.
If you have a relatively simple page you can use something like this:
|
Please take notice of some things:
-
1) In Windows 2000 we need to flush the contents of the processing so the actual update takes place before we
ask for the contents of the ASP page. This is not an issue in NT4 as buffering is turned off by default.
(If you have turned it on then follow the Win2000 example. If not just add a line after the
TRANSACTION
directive reading: Response.Buffer = True)
2) I am using absolute paths whenever possible because it will actually process faster. Relative paths or the
familiar technique Server.MapPath(FileName) require an extra trip to the registry.
3) The arguments of the CreateHTMLPage procedure use different slashes. The first one joins with
our web site address to form a complete URL and is therefore different than the Windows/DOS notation of finding
a file.
4) If you using something other than Win2000 then use Response.Redirect(FileName) instead
of Server.Transfer which is native to Win2000 and faster.
Well that's it! Again this is not a solution to all your slow ASP executions, but it could speed them up quite a bit. I used a relatively simple example but one could expand on it. For example if your whole Web site is made up of ASP pages you could change the default document in your "Internet Information Services" or "MS Management Console" to an HTML file first and then to ASP. That way if you create an HTML file using this method it will output that first. Another use of this method could be to process many pages at the same time and combine them... The sky is the limit. Have fun with it and let me know of any questions/comments!
Evagoras Charalambous
00229911@bigred.unl.edu
Attachments:
CreateHTMLPage.asp in text formatDefault.asp in text format



