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. Advertising

  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. 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,167
    eeebop
    Dec 10, 2004
  2. Luis Esteban Valencia
    Replies:
    0
    Views:
    2,516
    Luis Esteban Valencia
    Jan 6, 2005
  3. oyster
    Replies:
    0
    Views:
    482
    oyster
    Oct 21, 2008
  4. Nathan Sokalski
    Replies:
    0
    Views:
    545
    Nathan Sokalski
    Jan 15, 2009
  5. Lovely Angel For You

    Saving Images While Saving ASP Pages !

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

Share This Page