Saving current ASP page to Server

L

LC

Hi,

I would like to know how I can save my current ASP page
to the server side in html file format.

Then I would like to stream it back to the client side.

Any help is very much appreciated.

Thanks,
LC
 
S

Scott McNair

I would like to know how I can save my current ASP page
to the server side in html file format.

Copy/Paste the following:

'DEFINE YOUR FILE/FOLDER STUFF HERE
Dim Folder, File, WebPage
Folder = "c:\inetpub\wwwroot\"
File = "test.html"
WebPage = ""

'BUILD YOUR WEBPAGE HERE
Randomize
Write "The current time is: " & Now() & "<br>"
Write "Here's a random number: " & Int(Rnd(1)*500)+1 & ".<br>"

'I like how it boils down to this one line:
Save WebPage

'SUBROUTINES
Sub Write(myText)
'This sub is mainly here to cut down on the
'wear and tear of having to put this junk
'on every single line you want to append
'to the code, and to make sure it's easily
'readable when you view source

WebPage = WebPage & myText & vbcrlf
End Sub

Sub Save(myText)
'Creates the file in the location specified, and
'populates it with whatever is passed to it

Dim FSO, Stream, Overwrite, Unicode
Overwrite = True
Unicode = False
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set Stream = FSO.CreateTextFile(Folder & File, Overwrite, Unicode)
Stream.Write myText
Stream.Close
End Sub
 

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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top