I'm writing a new web service which needs to be able to write files to drives which are mapped to shares on the network.
Whenever I attempt to open a new file for writing, I get
System.IO.DirectoryNotFoundException: Could not find a part of the path "W:\bob.txt".
at System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy)
I've been reading up on this at various websites and as I suspected the issue appears to be to do with file permissions. The problem is that the drive "W:" is actually mapped to one of my own local shares for testing purposes and all local accounts have full access to this share so there shouldn't be a problem! Writing to that directory using the local address "C:\Someshareddirectory" works fine...
Just in case, I have also tried setting the impersonate option in Web.Config to be my username and password but it still fails with the above error...
This problem is really bugging me now so if anyone has any idea about what's going on I'd be grateful for your comments!