Saving current ASP page to Server

Discussion in 'ASP General' started by LC, Sep 24, 2004.

  1. LC

    LC Guest

    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
     
    LC, Sep 24, 2004
    #1
    1. Advertising

  2. 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" <> wrote in message
    news:241901c4a247$498c84a0$...
    > 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], Sep 24, 2004
    #2
    1. Advertising

  3. LC

    Scott McNair Guest

    "LC" <> wrote in news:241901c4a247$498c84a0
    $:

    > 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
     
    Scott McNair, Sep 24, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Kandell
    Replies:
    4
    Views:
    4,162
    eeebop
    Dec 10, 2004
  2. Lovely Angel For You

    Saving Images While Saving ASP Pages !

    Lovely Angel For You, Oct 2, 2003, in forum: ASP General
    Replies:
    1
    Views:
    209
    Curt_C [MVP]
    Oct 3, 2003
  3. LC

    saving current asp to server

    LC, Oct 1, 2004, in forum: ASP General
    Replies:
    2
    Views:
    104
    Ray Costanzo [MVP]
    Oct 1, 2004
  4. Jack
    Replies:
    3
    Views:
    612
    Tad J McClellan
    Dec 22, 2008
  5. Replies:
    3
    Views:
    385
Loading...

Share This Page