If anyone can shed some light on what I have already done. Right now what's being changed by user in one window, is not registered. Thanks.
This is ASP .NET, written in VB .NET
Partial Class _Default
Dim fileStreamReader As StreamReader
Dim newfileStreamReader As StreamReader
Dim i As Integer = 0
Dim j As Integer = 0
Dim fileStreamWriter As StreamWriter
Dim aString As String
Dim oldFile As String = "old.htm"
Dim newFile As String = "new0.htm"
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Private Sub Read_Write_Record()
.contentLabel.Text = ""
.TextBox1.Text = ""
.Label1.Text = "oldFile is " & oldFile
.Label2.Text = "newFile is " & newFile
.Label5.Text = ""
aString = ""
fileStreamReader = New StreamReader(Server.MapPath(oldFile))
j = j + 1
fileStreamWriter = New StreamWriter(Server.MapPath(newFile))
i = i + 1
While fileStreamReader.Peek <> -1
aString = fileStreamReader.ReadLine()
.TextBox1.Text = .TextBox1.Text & aString & ControlChars.CrLf
.contentLabel.Text = .contentLabel.Text & aString
Catch ex As Exception
Me.contentLabel.Text = "File doesn't exist!"
Me.Label5.Text = "i = " & i & "j = " & j
oldFile = newFile
newFile = "new" & i.ToString & ".htm"
.Label3.Text = "oldFile is " & oldFile
.Label4.Text = "newFile is " & newFile
Protected Sub ClickButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ClickButton.Click
Dim FileName As String = Server.MapPath("yourfile.txt")
Dim FileContents As String
Dim myStreamReader As StreamReader
If Not FileName Is Nothing Then
myStreamReader = File.OpenText(FileName)
FileContents = myStreamReader.ReadToEnd()
lblContent.Text = FileContents
Catch myException As Exception
How to write in your *.txt file:
Dim str As String = "bla blah..."
Dim sw As StreamWriter
sw = File.CreateText(Server.MapPath("yourfile.txt"))
Catch myException As Exception
I thought you wanted to create/read a ~.txt file and after reading your original post it is important to mention that what you want to do is dangerous. Allowing anyone to run an ~.aspx is very dangerous because he can run server code and for example he can delete all your website or something.
I understand exactly your goal coolrunning but it's too dangerous because you want to let anyone run server side script. People will be able to read, write and delete your website files. You give to others the same permission as you have. Believe me, do not do that except if you want to be hacked.
This is a 1 row 2 cols table. In the left cell, I use a textbox for input. In the right cell, I just let the browser do the displaying (rendering) of the text.
I find the dispaly area (the window to the right) get longer and longer, if the user enters a lot of text in the input area (the window to the left). The left window is a textbox, with a nice scrolling bar. The right window, unfortunately, just keeps growing as the input on the left window increases.
I tried frameset, but the ASP .NET in VB .NET did like it. I want to use textarea, which will give me the automatic scrolling bar. But I can't get the display like I had before with the regular table cell.
How do I get it, the right window, to display as it already has, as a browser, but has a scrolling bar when it gets too long? Thanks so much for looking into this.