无法在ASP .NET中使用“User.Identity.Name”获取Windows用户名 [英] Not able to get the Windows User Name using 'User.Identity.Name' in ASP .NET

查看:67
本文介绍了无法在ASP .NET中使用“User.Identity.Name”获取Windows用户名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用'MsgBox(User.Identity.Name)'来显示MessageBox中的当前Windows用户。出现的MessageBox显示App_Web_1gu0lxe5作为标题,消息为空。换句话说,我无法在输出中获得当前Windows用户。



我使用的是Windows 8.1 Enterprise,64位操作系统,Microsoft Visual Studio 2012 ,Visual Basic是编程语言,我正在尝试开发Web应用程序。



当我在运行Windows 7 Enterprise,Service的机器上运行相同的代码时打包1,64位操作系统代码产生所需的结果。



任何想法可能导致问题的原因是什么?

I am trying to use 'MsgBox(User.Identity.Name)' to show the Current Windows User in a MessageBox. The MessageBox that appears shows "App_Web_1gu0lxe5" as the Title and Message is Empty. In other words I am not able to get the Current Windows User in the Output.

I am using Windows 8.1 Enterprise, 64-bit Operating System, Microsoft Visual Studio 2012, Visual Basic is the Programming Language and I am trying to develop a Web Application.

When I am running the same code on a Machine running "Windows 7 Enterprise, Service Pack 1, 64-bit Operating System" the code produces the desired result.

Any Idea what could be the cause of the Problem?

推荐答案

MsgBox不适用于ASP.Net。您需要启用Windows身份验证才能获取该用户名。
MsgBox is not something that will work in ASP.Net. You need to enable Windows Authentication to be able to get that user name.


这篇关于无法在ASP .NET中使用“User.Identity.Name”获取Windows用户名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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