我知道Request.ServerVariables["LOGON_USER"]可以获取客户端的信息,但是必须在IIS里取消匿名登录,否则就是空字符串。
如果取消匿名登录,输入地址时总会弹出windows的身份验证对话框。
所以此方法行不通请教是否有其他方法能够在asp.net代码中获取客户端的用户信息(登录使用的帐号名,所属的域等)
如果取消匿名登录,输入地址时总会弹出windows的身份验证对话框。
所以此方法行不通请教是否有其他方法能够在asp.net代码中获取客户端的用户信息(登录使用的帐号名,所属的域等)
解决方案 »
- 线程间操作无效: 从不是创建控件“Form1”的线程访问它。
- 关于vs2008安装问题的
- 简单问题,自己思考多日不能解决,请热心人帮助。多谢了!!!
- 发送按键的问题
- WebRequest乱码的问题
- C#能否写如WIN32 API这种符合_STDCALL的DLL函数集?
- 怎么实现参数的返回??
- 微软真该做个Robocode游戏,让我们在AI算法..(大家来讨论一下)
- 大虾,怎样才能在一个form或panel中自由的融入别的Form
- vs. net 中有没有VSS??我没有找到, 可以告诉怎样安装???
- 必须声明变量 '@familyIDinsert'。小女子请教
- 关于使用计时器控件(Timer)的问题
WindowsImpersonationContext ctx = null;
try
{
// Start impersonating.
ctx = winId.Impersonate();
// Now impersonating.
// Access resources using the identity of the authenticated user.
}
// Prevent exceptions from propagating.
catch
{
}
finally
{
// Revert impersonation.
if (ctx != null)
ctx.Undo();
}
WindowsIdentity winId = (WindowsIdentity)HttpContext.Current.User.Identity;
WindowsImpersonationContext ctx = null;
try
{
ctx = winId.Impersonate();
WindowsIdentity.GetCurrent().Name
}
catch
{
}
finally
{
// Revert impersonation.
if (ctx != null)
ctx.Undo();
}
使用windows登录会弹出来那个对话框......