从系统或计算机中查找用户名 [英] find the user name from the system or computer

查看:104
本文介绍了从系统或计算机中查找用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在使用Web应用程序,并且该网站托管在window server 2003中,并且我们要求用户在每次尝试登录该网站时都应该能够从系统或计算机(窗口XP)中捕获用户名. br/>

我尝试使用以下所有语法:


Hello All,

I am working on web application and the website is hosted in the window server 2003 and we have requirement were in whenever the user try to login to the website , we should be able to capture the username from the system or computer(window XP)


I have try with the all the below syntax :


1) string a;
        a = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
        Response.Write(a.ToString());

       2) //System.Security.Principal.WindowsPrincipal wp = new
        //System.Security.Principal.WindowsPrincipal
        //(System.Security.Principal.WindowsIdentity.GetCurrent());
        //Response.Write(wp.Identity.Name);

       3) //System.Security.Principal.WindowsPrincipal p =     System.Threading.Thread.CurrentPrincipal as System.Security.Principal.WindowsPrincipal;
        //string strName = p.Identity.Name;

        //strName = HttpContext.Current.User.Identity.Name.ToString();
        //strName = Request.ServerVariables[5];
        //Response.Write(strName.ToString());

      4) // Response.Write(System.Environment.UserName.ToString());



以上所有语法均显示在托管网站的服务器的用户名中,但我想从用户计算机中捕获用户名

有人可以帮我吗?

预先谢谢你

[已编辑]代码包装在"pre"标签中[/已编辑]



above all the syntax are displayin the username from the server where the website is hosted but i want to capture the username from the user machine

Can any one help me on this ??

Thank you in advance

Code is wrapped in "pre" tag[/Edited]

推荐答案

您无法获得用户身份-出于安全原因,客户端在其浏览器后面受到了保护.
You can''t get the user identity - the client is protected behind his browser for security reasons.


Roancho Khan写道:
Roancho Khan wrote:

如果没有Windows,是否有可能身份验证,我们将能够获取用户详细信息?

Is it possible without windows authentication we will be able to get the user detail??



您可能渴望测试所有否"的味道. :-)

这与Windows身份验证无关.如果您远程登录,则用户为;那你需要知道什么?

想象一下,您实现了一个系统,该系统可以通知您该用户或远程计算机上的所有用户.它可以是一个客户端-服务器系统,要求用户信息的主机是客户端,需要获取有关服务器信息的所有主机.您可以在所有此类服务器计算机上实施并安装某些Windows服务.首先,即使对于服务器主机本地的应用程序,访问用户信息也将需要管理权限.这将严重违反正常的安全惯例.现在,此Windows服务应该是能够根据客户端请求发出此敏感信息的网络服务.最后,您需要不对客户端请求进行身份验证.

总体而言,从正常安全实践的角度来看,所有这三种违规行为看起来都是令人发指的.不过,您可以实现它,大概只能在Intranet内部实现.准备好这项工作后,建议您负责安全的系统管理员自行开枪. :-)

—SA



You are probably eager to test all flavors of "no". :-)

This is not related to Windows Authentication. If you log in remotely, the user is you; so what would you need to know?

Imagine you implement the system which informs you on the user or all users on a remote computer. It can be a client-server system, the host asking for user information being the client, all the hosts you need to get information about being servers. You can implement and install some Windows Service on all such server computers. First of all, even for an application local to the server host, access to user information will need administration privileges. This along would be a serious violation of normal safety practices. Now, this Windows Service should be a network Service capable of giving out this sensitive information on client''s requests. Finally, you require the client request to be not authenticated.

Overall, all three violations look outrageous from the standpoint of normal safety practices. Nevertheless, you can implement it, presumably only inside Intranet. When this work is ready, advise you system administrator responsible for safety to shoot himself. :-)

—SA


这篇关于从系统或计算机中查找用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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