I am developing an internal web application in asp.net core 2.2 & angular 9. I am looking to access the company's file server located in the same Windows server domain for the purpose of uploading, downloading or simply to list the contents of the directories. Do you have a way to do it natively or using a library?
Thanks in advance, I'm a little lost.
Update : I found this method but i have error "Access denied" :
NetworkCredential sourceCredentials = new NetworkCredential { Domain = "domain_name", UserName = "username", Password = "pass" };
try
{
NetworkConnection.NetworkConnection con =
new NetworkConnection.NetworkConnection(@"server_destination_directory", sourceCredentials);
using (con)
{
Console.WriteLine();
System.IO.File.Copy(@"server_destination_directory", @"file_to_copy", true);
}
}catch(Exception e)
{
return NotFound(e);
}
I have error "Access denied" like this:
The permissions is ok, i have activated windows and anonymous authentification, where the problem comes from ?
I found solution, in the destination path i need to specify the destination file, the error had nothing to do with permissions