Open and read/write ASPX file

Discussion in 'ASP .Net' started by David Lozzi, Nov 25, 2005.

  1. David Lozzi

    David Lozzi Guest

    Howdy,

    Trying to open and read/write another aspx file from my aspx page. Basically
    I want to be able to update my aspx files from the website. Here's my code
    so far:

    Dim path As String = Server.MapPath("tester.aspx")
    Dim din As New StreamReader(IO.File.OpenRead(path))
    Dim conts As String = din.ReadToEnd

    txtEdit.Text = conts

    But it doesn't work. If I use a text file, it works great, but not an ASPX
    file. I'm assuming they're protected? How do I get them open?

    Thanks!!

    --
    David Lozzi
    Web Applications Developer
    dlozzi@(remove-this)delphi-ts.com
    David Lozzi, Nov 25, 2005
    #1
    1. Advertising

  2. David Lozzi

    David Lozzi Guest

    Don't laugh too hard, but it works fine. My first attempt at this script I
    accidently selected OpenWrite which cleared the file. Then when reading a
    blank file, I got nothing back.

    I recreated the file with content and it works great now.

    Thanks!!

    --
    David Lozzi
    Web Applications Developer
    dlozzi@(remove-this)delphi-ts.com



    "David Lozzi" <> wrote in message
    news:...
    > Howdy,
    >
    > Trying to open and read/write another aspx file from my aspx page.
    > Basically I want to be able to update my aspx files from the website.
    > Here's my code so far:
    >
    > Dim path As String = Server.MapPath("tester.aspx")
    > Dim din As New StreamReader(IO.File.OpenRead(path))
    > Dim conts As String = din.ReadToEnd
    >
    > txtEdit.Text = conts
    >
    > But it doesn't work. If I use a text file, it works great, but not an ASPX
    > file. I'm assuming they're protected? How do I get them open?
    >
    > Thanks!!
    >
    > --
    > David Lozzi
    > Web Applications Developer
    > dlozzi@(remove-this)delphi-ts.com
    >
    >
    >
    >
    David Lozzi, Nov 25, 2005
    #2
    1. Advertising

  3. David Lozzi

    Ken Cox Guest

    Thanks for telling us what works! <grin>

    "David Lozzi" <> wrote in message
    news:...
    > Don't laugh too hard, but it works fine. My first attempt at this script I
    > accidently selected OpenWrite which cleared the file. Then when reading a
    > blank file, I got nothing back.
    >
    > I recreated the file with content and it works great now.
    >
    > Thanks!!
    >
    > --
    > David Lozzi
    > Web Applications Developer
    > dlozzi@(remove-this)delphi-ts.com
    >
    >
    >
    > "David Lozzi" <> wrote in message
    > news:...
    >> Howdy,
    >>
    >> Trying to open and read/write another aspx file from my aspx page.
    >> Basically I want to be able to update my aspx files from the website.
    >> Here's my code so far:
    >>
    >> Dim path As String = Server.MapPath("tester.aspx")
    >> Dim din As New StreamReader(IO.File.OpenRead(path))
    >> Dim conts As String = din.ReadToEnd
    >>
    >> txtEdit.Text = conts
    >>
    >> But it doesn't work. If I use a text file, it works great, but not an
    >> ASPX file. I'm assuming they're protected? How do I get them open?
    >>
    >> Thanks!!
    >>
    >> --
    >> David Lozzi
    >> Web Applications Developer
    >> dlozzi@(remove-this)delphi-ts.com
    >>
    >>
    >>
    >>

    >
    >
    Ken Cox, Nov 26, 2005
    #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. scad
    Replies:
    4
    Views:
    952
    James Kanze
    May 28, 2009
  2. Adam Bender
    Replies:
    18
    Views:
    764
    Gregory Brown
    May 2, 2009
  3. mike
    Replies:
    3
    Views:
    156
  4. Iulian Ilea
    Replies:
    1
    Views:
    310
    pcx99
    Dec 21, 2006
  5. Tim Chase
    Replies:
    0
    Views:
    88
    Tim Chase
    Dec 16, 2013
Loading...

Share This Page