Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have bunch of shared drive paths which I want to access through Web app. I have credentials to access this shared drive paths.

What I have tried:

I have searched through web and tried all possible solution but my web app failed every time !
The possible solution I found was enable identity impersonate but my web app is failing me in that case. I tried accessing it Using UNC API but that is failing too. I have been told that I can access this shared drives as directory service (dont need to use UNC API). Share your thoughts if you have any ! Thank you!
Posted
Comments
Kornfeld Eliyahu Peter 10-Aug-17 12:02pm    
Share your code...
Member 13261744 10-Aug-17 12:44pm    
I took a copy of UNCAccessWithCredentials from here

https://www.codeproject.com/Articles/43091/Connect-to-a-UNC-Path-with-Credentials

using (UNCAccessWithCredentials unc = new UNCAccessWithCredentials()) //access network drives through functional id
{

try
{
if (unc.NetUseWithCredentials(sharedrive, functionalID, domainName, functionalPass))
{
string[] files = Directory.GetFiles(sharedrive);
}
}
}


-- It throws error 87 inside NetUseWithCredentials() method

NOTE- As i mentioned may be it is possible to access these shared drives using directory service
marmikb 12-Apr-18 7:57am    
Using AD authentication this is quite possible, or you may share that folder with IIS Users.(Note: This options will give access to all the IIS users)
Member 13261744 10-Aug-17 12:46pm    
For identity impersonate
I am doing
<identity impersonate="true" userName="username" password="pass">
and it is not able to locate my project when I am enabling identity impersonate
--Gives System.IO.DirectoryNotFoundException

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