Home All Groups Group Topic Archive Search About

Open and read/write ASPX file

Author
25 Nov 2005 11:28 PM
David Lozzi
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

Author
25 Nov 2005 11:45 PM
David Lozzi
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



Show quoteHide quote
"David Lozzi" <DavidLozzi@nospam.nospam> wrote in message
news:uCsz0fh8FHA.2364@TK2MSFTNGP12.phx.gbl...
> 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
>
>
>
>
Are all your drivers up to date? click for free checkup

Author
26 Nov 2005 1:01 AM
Ken Cox
Thanks for telling us what works! <grin>

Show quoteHide quote
"David Lozzi" <DavidLozzi@nospam.nospam> wrote in message
news:OIb9bph8FHA.3760@TK2MSFTNGP14.phx.gbl...
> 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" <DavidLozzi@nospam.nospam> wrote in message
> news:uCsz0fh8FHA.2364@TK2MSFTNGP12.phx.gbl...
>> 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
>>
>>
>>
>>
>
>

Bookmark and Share