0

Im trying to write a program in C# that opens a network share on my local network. The problem i run into is getting past the user login of the network share.

Normally in windows i can just \192.168.101.10 enter in username "nick" password "nick"

so my code is as follows

 void FolderPathList_MouseDoubleClick(object sender, MouseButtonEventArgs e)
    {
        //throw new NotImplementedException();

        ComputerModel selectedCm = (ComputerModel)FolderPathList.SelectedItem;
        string uname = "nick";
        System.Security.SecureString password= new System.Security.SecureString("nick");
        if (CaptureDevices.IsChecked != true) System.Diagnostics.Process.Start("explorer.exe", uname, password, "\\\\192.168.101."+selectedCm.IP+"\\ppt");
        if (CaptureDevices.IsChecked != false) System.Diagnostics.Process.Start("explorer.exe", uname, password, "\\\\192.168.101."+selectedCm.IP+"\\c$\\users\\nick\\desktop");
    }

It works absolutely fine if i have just

 void FolderPathList_MouseDoubleClick(object sender, MouseButtonEventArgs e)
    {
        //throw new NotImplementedException();

        ComputerModel selectedCm = (ComputerModel)FolderPathList.SelectedItem;
                    if (CaptureDevices.IsChecked != true) System.Diagnostics.Process.Start("explorer.exe", "\\\\192.168.101."+selectedCm.IP+"\\ppt");
        if (CaptureDevices.IsChecked != false) System.Diagnostics.Process.Start("explorer.exe", "\\\\192.168.101."+selectedCm.IP+"\\c$\\users\\nick\\desktop");
    }

However i first have to hit each computer in my local network first, enter in the username and password once, and then the computer remembers it. However whenever i shut down and start back up again i have to do it manually each time. Am i doing this wrong?

  • using the same username and password for your credentials is a serious security faux pas. ;) – apollosoftware.org Jul 17 '13 at 20:41
  • 1
    [This](http://stackoverflow.com/questions/659013/accessing-a-shared-file-unc-from-a-remote-non-trusted-domain-with-credentials) answer might help you. At least stop trying to start explorer AND pass credentials to it. That is incredible hard to get working... – rene Jul 17 '13 at 20:44
  • The link in the above comment or this link: http://stackoverflow.com/questions/295538/how-to-provide-user-name-and-password-when-connecting-to-a-network-share/1197430#1197430 – Display Name is missing Jul 17 '13 at 20:50

0 Answers0