I have a .net 4 winform application that for one computer the System.IO.File.Exists("my file path") that returns false every time.
- The file is there.
- If the user, using file explorer can see, open, save... the file and has complete access to the folder.
- I made a separate winforms application that has very simple code (see below) and it works. The same file is found.
Here is the code:
If System.IO.File.Exists(txtPath.Text) Then
lblResults.BackColor = Color.Green
lblResults.Text = "Found"
Else
lblResults.BackColor = Color.Red
lblResults.Text = "No Joy"
End If
I also in the application that does not work use a 3rd party dll to read an imap mail box. Again this computer throws an error while trying to save the attachments to the root same path the error is below
saveAttachedFile:
index: 0
dir: Z:\XXX\Email\Attachments\6b333c68-4382-438c-99db-51a13ad1d71a\Attachments\
ensureDir:
createDirWin32:
WindowsError: The system cannot find the path specified.
WindowsErrorCode: 0x3
--createDirWin32
createDirWin32:
WindowsError: The system cannot find the path specified.
WindowsErrorCode: 0x3
--createDirWin32
Cannot ensure directory existence (2)
path: Z:\XXX
--ensureDir
Directory does not exist and cannot be created.
directory: Z:\CVO\Email\Attachments\6b333c68-4382-438c-99db-51a13ad1d71a\Attachments\
--saveAttachedFile
so it seems that it is a permission issue. But then again the user/computer has access to it via explorer or the 2nd .net application that only checks if the file is there?
I am not sure what else to try. Any help suggestions would be truly appreciated.
Have tried this one multiple computers in the domain and they all work. Have tried different users logging on to the computer same issue. File not found Ran the 1st Application as Administrator same issue, File not found.
If System.IO.File.Exists(txtPath.Text) Then
lblResults.BackColor = Color.Green
lblResults.Text = "Found"
Else
lblResults.BackColor = Color.Red
lblResults.Text = "No Joy"
End If
System.IO.File.Exists(txtPath.Text) return False in one application but True in a second one