Hi I have a written for code for writing a file in the remote server in .net. When I keep output path as local drive – the code works fine and creates folders and text files. But when I point to a remote server, I get below error:
System.UnauthorizedAccessException: Access to the path '\\ServerName\FolderTest\FolderTest1\AB.txt' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
at ...
If you need additional information let me know
The code worked properly now. The issue was the access permission. The credential with my code wrote to the folder was not added to the folder security tab. After adding to it. It worked. Thanks @James Deville, @VMAtm and @Razvan Panda 🙂