-
ASP.NET File
Hey,
I ahve a asp.net web page. I want it to edit a file on the server. How could I do this?
I tried this code :
Code:
Dim file_name As String = ("http://localhost/cassgroupmainpage/" & ListBox1.SelectedValue & "/" & ListBox2.SelectedValue & ".xml")
Dim stream_reader As New IO.StreamReader(file_name)
Dim a As String
a = stream_reader.ReadToEnd()
stream_reader.Close()
a = Replace(a, "</posts>", "")
Dim b As String
b = "<post>"
b = (b + vbCrLf + "Posted by" + TextBox4.Text + vbCrLf + vbCrLf + "Posted date " + System.DateTime.Today() + vbCrLf + "Message : " + vbCrLf + TextBox2.Text + "</post>" + vbCrLf + "</posts>")
Dim file_name1 As String = ("http://localhost/cassgroupmainpage/" & ListBox1.SelectedValue & "/" & ListBox2.SelectedValue & ".xml")
Dim stream_writer As New IO.StreamWriter(file_name1, False)
stream_writer.Write(b)
stream_writer.Close()
I'm new to coding ASP.NET (vb).
Thanks,
Matt Cassell
yes i have the perminssions set.
-
post in the asp.net forum