[RESOLVED] Error Reading Text File From Client PC
I have the code below. On my web page, I have a textbox and a
button. User enters the filename and path (ex. c:\test.txt) on the textbox and clicks on the button to process the file.
If I run it on the machine hosting the site, I have no errors.
However, when I run it on a client PC, I get an error. It's not
reading the file entered into the textbox.
Am I missing anything here? Why would it not read the text file in the client PC?
TIA
VB Code:
Imports System.IO
Imports System.Data.SqlClient
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strFILELINE As String
'+-------------------+
'| INITIALIZE ARRAYS |
'+-------------------+
Dim arLINEREAD() As String
'+-----------------------+
'| OPEN THE FILE TO READ |
'+-----------------------+
Dim objStreamReader As StreamReader
objStreamReader = File.OpenText(TextBox1.Text)
'+-------------------------+
'| READ ONE LINE AT A TIME |
'+-------------------------+
While objStreamReader.Peek() <> -1
'+--------------------------------+
'| PLACE LINE DATA INTO THE ARRAY |
'+--------------------------------+
arLINEREAD = Split(objStreamReader.ReadLine(), ",")
'+--------------------------------+
'| PROCESS LINE TO THE SQL SERVER |
'+--------------------------------+
ADD_ENTRIES(arLINEREAD(0).ToString, arLINEREAD(1).ToString, arLINEREAD(2).ToString, Session.SessionID)
End While
'+--------------+
'| CLOSE OBJECT |
'+--------------+
objStreamReader.Close()
'+--------------------------+
'| DISPLAY INFO TO THE GRID |
'+--------------------------+
With DataGrid1
.CurrentPageIndex = 0
.DataSource = GetVERIZONList(Session.SessionID)
.DataBind()
.Visible = True
End With
End Sub
End Class