I am trying to map a network drive on to the server inside a windows service written in c#. I tried using net.exe with below code
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.UseShellExecute = false;
p.StartInfo.CreateNoWindow = true;
p.StartInfo.RedirectStandardError = true;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "net.exe";
p.StartInfo.Arguments = " use " + DriveLetter + Path + " " + Password + " /user:" + Username;
p.Start();
p.WaitForExit();
the arguments basically translate to " use X: \\192.45.xx.xxx\sharename "xxxx" /user: domainname\username"
i get a "network name not found" error when this executes. The server i am trying to access is on a different domain than the one my app is sitting on, which is why i think i get that error.
Does anyone know how i can get past this and map a shared folder from another domain on to my local computer?
I'd greatly appreciate any help
Thanks Karthik