在aspx网页上获取Windows用户名

编程入门 行业动态 更新时间:2024-10-11 11:16:36
本文介绍了在aspx网页上获取Windows用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

VB,VS2010 i想要获取登录客户端PC的用户名访问网页 i试过

VB, 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用户名

本文发布于:2023-11-07 02:10:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1565273.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:用户名   网页   aspx   Windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!