Could not find path error

S

Steve

Hi all,
I am referring to this article in MSDN :
http://msdn.microsoft.com/library/en-us/secauthn/security/logonuser.asp

While creating folder on the remote machine, we are specifying the UNC path
as per the example. But we get this error "could not find a part of the
path".

we are prefixing the path with @ symbol and also tried with the escaping the
"\\".
Path is correct and and all the permissions have been granted. ASP.net
application and the remote folder machine are in the same domain. We tried
with mapped drive as well , it did't work.

We are trying out the sample application you have sent. CreateFolder method
is invoked from the Default.appx.cs file's Page_load method and remote
folder path is passed to the CreateFolder method and it is shown below.

CreateFolder(@"\\mypath\shared", "IOFolder");
Here mypath is the remote machine and is in the same domain of Web
application. "shared" folder is shared for everyone and full access has been
given to all the users.

Below is the code snippet from the CreateFolder Method

try

{

DirectoryInfo dirInfo = new DirectoryInfo(strTragetLocation);

Response.Write(dirInfo.Exists);

string strFolderToCreate = strTragetLocation + "\\" + strFolder;

Directory.CreateDirectory(strFolderToCreate);

}

catch (Exception ex)

{

Response.Write(ex.Message);

return false;

}

In the above code DirectoryInfo.Exists method returns false and after that
it tries to CreateDirectory and it throws the following exception "Could not
find a part of the path \"\\\\mypath\\shared\."."

Any ideas ?
 
B

bruce barker

the problem is probably permission. unless your asp.net account is a domain
account, it will not be able to access the share. if you must use a local
account, you will need to set the password, and create a matching local
account (with the same password) on the share, or use impersonation and fill
a domain account and password.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,225
Members
46,815
Latest member
treekmostly22

Latest Threads

Top