Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
c#网络登录_C#_Networking - Fatal编程技术网

c#网络登录

c#网络登录,c#,networking,C#,Networking,如何执行网络登录以访问共享驱动程序(例如,在c#中以编程方式)?通过尝试通过资源管理器打开共享,或使用net use shell命令,也可以实现同样的效果。如果需要使用Windows身份模拟,请查看这些链接 p/Invoke调用将完成此任务。寻找更多信息 [DllImport("mpr.dll")] public static extern int WNetAddConnection2A ( [MarshalAs(UnmanagedType.LPArray)] NETRESOUR

如何执行网络登录以访问共享驱动程序(例如,在c#中以编程方式)?通过尝试通过资源管理器打开共享,或使用net use shell命令,也可以实现同样的效果。

如果需要使用Windows身份模拟,请查看这些链接

p/Invoke调用将完成此任务。寻找更多信息

[DllImport("mpr.dll")]
 public static extern int WNetAddConnection2A
 (
      [MarshalAs(UnmanagedType.LPArray)] NETRESOURCEA[] lpNetResource,
      [MarshalAs(UnmanagedType.LPStr)] string lpPassword,
      [MarshalAs(UnmanagedType.LPStr)] string UserName, int dwFlags
 );