局域网中共享目录,基于用户名和密码的下载?(非FTP)
请问怎么做,该怎么样传送用户名和密码?服务器上有一个要密码访问的共享文件夹。
在客户端写一个基于密码验证程序!
我的思路是,先得到Server端的共享UNC,传送User 和Password,并验证。
但我不知道怎么实现这一步!

解决方案 »

  1.   

    User 这个类里有域用户的ID的!
      

  2.   

    运行net 命令
    先执行net 命令,附上用户名称和口令 就可以了
      

  3.   

    不用net呀,能有什么类和API吗?
    最好是用类!
    因为我从没接触过API,只是有这个打算!
      

  4.   

    public  string  ConnectLan()
    {
    Process  p;
    p=new Process();
    p.StartInfo.FileName="cmd.exe"; 
    // 这里是关键点,不用Shell启动/重定向输入/重定向输出/不显示窗口
    p.StartInfo.UseShellExecute = false;
    p.StartInfo.RedirectStandardInput = true;
    p.StartInfo.RedirectStandardOutput = true;
    p.StartInfo.CreateNoWindow = true;p.Start();
    p.StandardInput.WriteLine("net use \\\\Nt02   密码  /user:用户名");// 向cmd.exe输入command
    p.StandardInput.WriteLine("exit");
    p.WaitForExit();
    string s = p.StandardOutput.ReadToEnd();// 得到cmd.exe的输出
    p.Close();
    return s;}
      

  5.   

    收藏,您上面的目的就是我想要的,用net use不是我想要的。
    楼上能讲讲别的办法吗?详细点,用.net类库里面的方法能实现就更好!
    用API的话,我没有接触过,不过代码详细的话也行!