Click here to Skip to main content
15,887,975 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
We're trying to read an MS Access file that's stored on a Network Location. We're facing an Access Denied message whenever trying to read: System.UnauthorizedAccessException: 'Access to the path is denied'

we are using the following code to authenticate the access to the share location:

C#
NetworkCredential theNetworkCredential = new NetworkCredential(@"server\user", "password");
CredentialCache theNetcache = new CredentialCache();
theNetcache.Add(new Uri(@"\server\c$"), "Basic", theNetworkCredential);

string[] theFolders = System.IO.Directory.GetDirectories(@"\server\c$\DirectoryWithAccessFile");


What I have tried:

others have suggested we invoke the mpr.dll library, which we think we cannot use since our target deployment will be on a linux OS
Posted
Updated 22-Jul-19 23:10pm
v2

1 solution

"\server\c$\..." isn't a UNC path, it should be

"\\server\c$\..."


You'll also need write access (yes, just to read as it will create temp files in the same folder the database exists on) but if you're going through c$ you shouldn't have a problem with that.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900