Open and read/write ASPX file

D

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!!
 
D

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!!
 
K

Ken Cox

Thanks for telling us what works! <grin>

David Lozzi said:
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!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top