saving current asp to server

Discussion in 'ASP General' started by LC, Oct 1, 2004.

  1. LC

    LC Guest

    Hi,

    Many Weeks ago I posted this:
    I would like to know how I can save my current ASP page
    to the server side in html file format.

    I got a very nice reply back from Scott McNair. Thank
    you very much Scott.

    This code was provided by Scott:
    <%
    'DEFINE YOUR FILE/FOLDER STUFF HERE
    Dim Folder, File, WebPage
    Folder = "E:\HRForms"
    File = "test.html"
    WebPage = "http://uspa011410/hr/PrintChangeStatus2.asp"

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

    '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


    %>

    However, I have a pre-developed ASP that contains all the
    information I need. As soon as that page loads up I want
    that ASP to be saved as a html file.

    If Scott or anyone can help me with this, I very much
    appreciate it.

    Thanks.
    LC
     
    LC, Oct 1, 2004
    #1
    1. Advertising

  2. "LC" <> wrote in message
    news:2d5d01c4a7bb$32746bb0$...
    > Hi,
    >
    > Many Weeks ago I posted this:
    > I would like to know how I can save my current ASP page
    > to the server side in html file format.
    >
    > I got a very nice reply back from Scott McNair. Thank
    > you very much Scott.
    >
    > However, I have a pre-developed ASP that contains all the
    > information I need. As soon as that page loads up I want
    > that ASP to be saved as a html file.
    >
    > If Scott or anyone can help me with this, I very much
    > appreciate it.


    Create another ASP that uses the technique in the link provided below to
    call the ASP you want to save and then write the output to disk.
    http://www.aspfaq.com/show.asp?id=2173

    --
    Tom Kaminski IIS MVP
    http://www.microsoft.com/windowsserver2003/community/centers/iis/
    http://mvp.support.microsoft.com/
    http://www.iisfaq.com/
    http://www.iistoolshed.com/ - tools, scripts, and utilities for running IIS
    http://www.tryiis.com
     
    Tom Kaminski [MVP], Oct 1, 2004
    #2
    1. Advertising

  3. Unfortunately, there isn't any functionality in ASP like:

    sHTML = Response

    What you'd have to do instead, as one option, is use something like this,
    http://www.aspfaq.com/show.asp?id=2173 (first code snippet), but instead or
    Response.Writing the .ResponseText, write the ResponseText into a file.

    Ray at work

    "LC" <> wrote in message
    news:2d5d01c4a7bb$32746bb0$...
    > Hi,
    >
    > Many Weeks ago I posted this:
    > I would like to know how I can save my current ASP page
    > to the server side in html file format.
    >
    > I got a very nice reply back from Scott McNair. Thank
    > you very much Scott.
    >
    > This code was provided by Scott:
    > <%
    > 'DEFINE YOUR FILE/FOLDER STUFF HERE
    > Dim Folder, File, WebPage
    > Folder = "E:\HRForms"
    > File = "test.html"
    > WebPage = "http://uspa011410/hr/PrintChangeStatus2.asp"
    >
    > 'BUILD YOUR WEBPAGE HERE
    > Randomize
    > Write "The current time is: " & Now() & "<br>"
    > Write "Here's a random number: " & Int(Rnd(1)*500)+1
    > & ".<br>"
    > Write "why doesnt this work"
    >
    > '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
    >
    >
    > %>
    >
    > However, I have a pre-developed ASP that contains all the
    > information I need. As soon as that page loads up I want
    > that ASP to be saved as a html file.
    >
    > If Scott or anyone can help me with this, I very much
    > appreciate it.
    >
    > Thanks.
    > LC
    >
    >
     
    Ray Costanzo [MVP], Oct 1, 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. Luis Esteban Valencia
    Replies:
    0
    Views:
    2,511
    Luis Esteban Valencia
    Jan 6, 2005
  3. 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
  4. LC

    Saving current ASP page to Server

    LC, Sep 24, 2004, in forum: ASP General
    Replies:
    2
    Views:
    264
    Scott McNair
    Sep 24, 2004
  5. Jack
    Replies:
    3
    Views:
    612
    Tad J McClellan
    Dec 22, 2008
Loading...

Share This Page