您的位置:首页 > 移动开发

ASP.net Application 中使用域用户登录

2005-05-21 21:44 309 查看
转自:http://weblogs.3322.org/
现在做的一个程序中要求ASP.net 程序可以使用已经存在的域用户来登录(而且为了与其它程序界面一致一定要使用 Forms 登录),查找了一些相关的资料发现还是可以实现的。
主要还是依靠
advapi32.dll 中的 LogonUser API 函数。


using System.Web.Security;
using System.Runtime.InteropServices;

[DllImport("advapi32.dll", CharSet=CharSet.Auto)]
public static extern int LogonUser(String lpszUserName,
String lpszDomain,
String lpszPassword,
int dwLogonType,
int dwLogonProvider,
ref IntPtr phToken);

public const int LOGON32_LOGON_INTERACTIVE = 2;
public const int LOGON32_PROVIDER_DEFAULT = 0;

void Login_Click(Object sender, EventArgs E)

其它方面的使用与普通的forms 程序没有太大的区别,也许还有更好的方法。

附注:技术的连贯性体现
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐