0

我试图用 C# 编写一个程序,在我的本地网络上打开一个网络共享。我遇到的问题是通过网络共享的用户登录。

通常在 Windows 中,我只能在 \192.168.101.10 中输入用户名“nick”密码“nick”

所以我的代码如下

 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");
    }

如果我刚刚

 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");
    }

但是,我首先必须先访问本地网络中的每台计算机,输入用户名和密码一次,然后计算机才会记住它。但是,每当我关闭并重新启动时,我每次都必须手动进行。我做错了吗?

4

0 回答 0