c#网络登录
我如何执行网络登录,以访问共享驱动程序为例,以编程方式在C#中? 通过试图通过资源管理器打开共享或通过net use shell命令可以实现同样的目的。
对WNetAddConnection2的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
);
您需要使用Windows Identity Impersonation,查看这些链接http://blogs.msdn.com/shawnfa/archive/2005/03/21/400088.aspx http://blogs.msdn.com/saurabhkv /archive/2008/05/29/windowsidentity-impersonation-using-c-code.aspx
链接地址: http://www.djcxy.com/p/6117.html上一篇: c# network login
下一篇: Mdbg, Dbgclr, Cordbg
