如何在asp.net中没有Windows登录提示的情况下获取Windows登录用户名 [英] How to get windows logged user name without windows login prompt in asp.net

查看:119
本文介绍了如何在asp.net中没有Windows登录提示的情况下获取Windows登录用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我使用下面提到的代码来获取登录的Windows用户名,

IIdentity WinId = HttpContext.Current.User.Identity;

WindowsIdentity wi =(WindowsIdentity)WinId;

string user_name = wi.Name;



此代码


1.我在IIS中取消选中匿名身份验证。

2.启用Windows身份验证。



但是在运行它时询问Windows登录提示。然后我才会记录Windows用户名。



我需要使用匿名身份验证来获取Windows用户名。 !!!!!!!



请做...

Hi,
I using below mention code to get logged windows username,
IIdentity WinId = HttpContext.Current.User.Identity;
WindowsIdentity wi = (WindowsIdentity)WinId;
string user_name = wi.Name;


for this code,
1.I have unchecked anonymous authentication in IIS.
2.Enabled windows authentication.

But while running it's asking windows login prompt. then only i m getting logged windows username.

I need using anonymous authentication to get windows username. !!!!!!!

Please do needful...

推荐答案

如果要获取客户端使用的Windows用户名是使用您的应用程序,则必须使用Windows身份验证或要求用户在应用程序的某处输入用户名。
If you want to get the windows user name of the client use is using your application, you have to either use windows authentication or ask the user to enter the user name somewhere in your application.


这篇关于如何在asp.net中没有Windows登录提示的情况下获取Windows登录用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆