Can't connect to network drive (with credentials)

时间:2019-03-19 15:09:15

标签: c# cmd

I need to connect to a network drive for which i have the username and password however its not playing ball.

I first of all tried things such as the following: Connect to network drive with user name and password

This wasnt working for me so i decided to just call Net USE to give myself permissions

Process process3 = new Process()
{
    StartInfo = 
    {
        FileName = "cmd.exe",
        Arguments = "/C NET USE " + Aurora03.path + " " + Aurora03.password + " /User:" + Aurora03.username
    }
};

process3.Start();
process3.WaitForExit();

My arguments look like this

Arguments = "/C NET USE \\phd-aurora03\Aurinput\Reports\ Password /User:aurora"

Its returning exit code 2 i believe.

After this runs im getting the error saying i cant connect to the unc path so its not working at all.

0 个答案:

没有答案