Re: Creating ASPX dynamically and saving as single file .ASPX

Discussion in 'ASP .Net' started by Anthony Jones, Jan 15, 2009.

  1. "davebullet" <u48867@uwe> wrote in message news:9031ddd5f35f9@uwe...
    > Hi there,
    >
    > I want to be able to dynamically create a new ASPX in code and save this
    > to a
    > aspx file to another website.
    >
    > I don't want to save the rendered HTML from the ASPX page created. I want
    > to
    > save the ASPX page definition itself (the .aspx version of the in memory
    > created page).
    >
    > Creating the page in code is easy, but how do I persist it as an ASPX
    > file?



    Create the content as a string then:-

    System.IO.File.WriteAllText(fullfilepath, aspxcontent,
    System.Text.Encoding.UTF8);



    --
    Anthony Jones - MVP ASP/ASP.NET
     
    Anthony Jones, Jan 15, 2009
    #1
    1. Advertisements

  2. "davebullet via DotNetMonster.com" <u48867@uwe> wrote in message
    news:903d30c04792c@uwe...
    > Writing some text to a file isn't the problem. I should have been clearer
    > in
    > my question (sorry).
    >
    > My problem is I don't know how to extract extract the aspx "source" in
    > memory?
    > I have a System.Web.UI.Page instance with controls on it. How do I
    > extract
    > the source definition into a string which I can then persist to a file?
    >
    > Is there a property or method of a System.Web.UI.Page or System.Web.UI.
    > HtmlControls.HtmlForm that contains the page "source"?
    >


    In short you can't. The system was never designed with that sort of
    requirement in mind. It would be like creating a compiler that generated
    native code that could be easily de-compiled back to the original source.



    --
    Anthony Jones - MVP ASP/ASP.NET
     
    Anthony Jones, Jan 16, 2009
    #2
    1. Advertisements

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. Christopher D. Wiederspan

    Saving Downloaded Xml from ASPX page as File

    Christopher D. Wiederspan, Sep 9, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    456
    Christopher D. Wiederspan
    Sep 9, 2004
  2. ES
    Replies:
    0
    Views:
    568
  3. John Kandell
    Replies:
    4
    Views:
    4,440
    eeebop
    Dec 10, 2004
  4. Luis Esteban Valencia
    Replies:
    0
    Views:
    2,745
    Luis Esteban Valencia
    Jan 6, 2005
  5. =?Utf-8?B?QnJ1Y2UgUmFtc2V5?=

    Saving Aspx Output to File On Server

    =?Utf-8?B?QnJ1Y2UgUmFtc2V5?=, Jul 6, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    621
    =?Utf-8?B?Q293Ym95IChHcmVnb3J5IEEuIEJlYW1lcikgLSBN
    Jul 6, 2005
  6. David Ichilov

    Re: saving HTML file from aspx

    David Ichilov, Sep 22, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    498
    =?Utf-8?B?VmlqYXk=?=
    Nov 7, 2005
  7. Lovely Angel For You

    Saving Images While Saving ASP Pages !

    Lovely Angel For You, Oct 2, 2003, in forum: ASP General
    Replies:
    1
    Views:
    356
    Curt_C [MVP]
    Oct 3, 2003
  8. Water Cooler v2
    Replies:
    2
    Views:
    691
    Water Cooler v2
    Apr 18, 2006
Loading...