在aspx网页上获取Windows用户名 [英] get windows username in aspx webpage

查看:271
本文介绍了在aspx网页上获取Windows用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





VB.net,VS2010

i想要获取登录客户端PC的用户名访问网页

i试过



VB.net, VS2010
i would want to get the username of the person logged client pc that accesses the webpage
i have tried

HttpContext.Current.User.Identity.Name.ToString().Remove(0, 7)



但是一旦网页进入实时环境,它就会抛出错误



请帮我这个



谢谢

Joe


but once the webpage is in the live env, it throws an error

please help me on this

thanks
Joe

推荐答案

除非您使用会员提供商,否则它将无效,即使这样,它也只会给您用户登录到您的网络系统。

您无法让客户端登录他的机器的身份 - 他甚至可能没有,但安全性不允许您甚至找到它。

服务器无法访问用户环境的详细信息,并且他的登录ID是该信息的一部分。
That won't work unless you are using Membership Providers, and even then it will only give you the user log in to your web system.
You cannot get the client log in identity for his machine - he may not even have one, but security does not allow you to even find that out.
The server cannot access details of the users environment, and his log in id is part of that information.


经过一些搜索,得到了这样做的方法并且正在工作好吧

已将身份验证设置为wind在webconfig中进行ows并设置IIS以使用基本的Windows身份验证。

并使用
after some searching, got the way to do this and is working well
had set the authentication to windows in the webconfig and set up IIS to use basic windows authentication.
and it pulls out the username with the
User.Identity.Name

提取用户名

并添加 System.Web System.Web.Security



尝试过在服务器上托管后使用它并运行良好。


and adding System.Web and System.Web.Security

tried using this after hosting it on the server and works well.


这篇关于在aspx网页上获取Windows用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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