U
urbanwks
Guest
TLDR; File accessible by StreamReader for many users of program, but does not work for one user/machine. Confirmed that user has proper access to file.
I have a program that is parsing data from a saved text file stored on a network share. Roughly 20 users/PCs are able to use this program without issue, however one user is unable to perform the task, receiving an exception:
System.IO.FileNotFoundException: Could not find file
'\\server\path\to\folder\file.G5246V00'.
(obviously not the actual path, but the logic remains the same)
The file exists, and this particular user can manually navigate to the share/folder and open the file through Windows Explorer, so he has proper access. Here's the relevant code block:
Dim lines As New List(Of String)
Dim sr As New StreamReader(strNEDir & sFilename)
While Not sr.EndOfStream 'read each line until the end
Dim line As String = sr.ReadLine
For Each row As DataGridViewRow In Me.gridNE.Rows
If Mid(line, 2, 8) = Mid(row.Cells("colTask").Value.ToString, 1, 8) Then 'check if line = task
If Not lines.Contains(line) Then
lines.Add(line) 'if it does, add to list to send for display
End If
End If
Next
End While
sr.Close()
The exception is thrown when trying to open the file with StreamReader (bolded line, I've confirmed that 'strNEDir & sFilename' is properly populated with the correct full path - those vars are populated elsewhere). This is clearly some setting pertaining specifically to this user or machine, anyone have any clue what it might be? What am I missing here?
Continue reading...
I have a program that is parsing data from a saved text file stored on a network share. Roughly 20 users/PCs are able to use this program without issue, however one user is unable to perform the task, receiving an exception:
System.IO.FileNotFoundException: Could not find file
'\\server\path\to\folder\file.G5246V00'.
(obviously not the actual path, but the logic remains the same)
The file exists, and this particular user can manually navigate to the share/folder and open the file through Windows Explorer, so he has proper access. Here's the relevant code block:
Dim lines As New List(Of String)
Dim sr As New StreamReader(strNEDir & sFilename)
While Not sr.EndOfStream 'read each line until the end
Dim line As String = sr.ReadLine
For Each row As DataGridViewRow In Me.gridNE.Rows
If Mid(line, 2, 8) = Mid(row.Cells("colTask").Value.ToString, 1, 8) Then 'check if line = task
If Not lines.Contains(line) Then
lines.Add(line) 'if it does, add to list to send for display
End If
End If
Next
End While
sr.Close()
The exception is thrown when trying to open the file with StreamReader (bolded line, I've confirmed that 'strNEDir & sFilename' is properly populated with the correct full path - those vars are populated elsewhere). This is clearly some setting pertaining specifically to this user or machine, anyone have any clue what it might be? What am I missing here?
Continue reading...