c# - File Copy to network share fails when user does not have Write permissions to application folder -
I have a simple C # application that allows users to copy files from a template folder to a SFTP server on the network Is used for. This application shares the network and the user accesses it through the mapped drive on their desktop.
Our problem is that if a user does not allow the application folder then the copy fails with the exception "unknown user name or bad password".
So, here's the scenario:
Security Group A : Read; Execute the List Folder Content
Security Group B : Modify & amp; Write Exclusive List Folder Content
\\ network.com \ public \ sftp_test - Group A and B
: - Network for Networks Controlled Apps From Mapped Drives Share the share
The code where the exception occurs:
{network credentials creds = new network credentials ([serverusername], [ Password]); Credential Cash Cache = New Credential Cash (); Cash Add (New Uri (@ "\ \ [IP Address]"), "Basic", credits); Var sftpFile = string.format (@ "\\ [ip address] \ sftp \ {0} _ {1} .zip", [user name], datetime.Now.ToString ("MMddyyhhssmm")); System.IO.File.Copy (zip, sftpFile); Console WrightLine ("The file was successfully sent to the server!"); } Hold (exception x) {console. WrightLine (x.Message); }
A security group that receives an exception from any user trying to copy a file.
To get a copy of any user, the security message is received in Group B
Is there anything I'm missing?
Should users have the rights to that folder, where the application remains?
Comments
Post a Comment