IIS ASP - Saving current ASP page to Server

This is Interesting: Free IT Magazines  
Home > Archive > IIS ASP > September 2004 > Saving current ASP page to Server





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Saving current ASP page to Server
LC

2004-09-24, 5:51 pm

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
Curt_C [MVP]

2004-09-24, 5:51 pm

write the content out to a string in the page instead of directly, then use
FSO to put the string contents into a file.

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com


"LC" <lc@hotmail.com> wrote in message
news:241901c4a247$498c84a0$a401280a@phx.gbl...
> 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



Ray Costanzo [MVP]

2004-09-24, 5:51 pm

Another option is to treat your page as the "remote" page in this sample,
http://www.aspfaq.com/show.asp?id=2173 (first code block), but instead of
Response.Writing the responseText, write it to a file with the File
Scripting Object.

Ray at work

"LC" <lc@hotmail.com> wrote in message
news:241901c4a247$498c84a0$a401280a@phx.gbl...
> 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



Scott McNair

2004-09-24, 5:51 pm

"LC" <lc@hotmail.com> wrote in news:241901c4a247$498c84a0
$a401280a@phx.gbl:

> 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
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com