I have a UNC/network share(Windows FSX) and I would like my ASP.Net Core Web application to read the files from this network share. I tried to use SimpleImpersonation nuget package, however it seems to be deprecated. How to read the files from network share in .Net core? This is what I tried so far -
var credentials = new UserCredentials(uncPath, userName, password);
var result = WindowsIdentity.RunImpersonated(credentials, () => {
return _fileSystem.File.ReadAllText($"\\\\{uncPath}\\test.txt");
});