在IIS6.0中部署ASP.NET应用程序 [英] Deploying asp.net application in IIS6.0

查看:86
本文介绍了在IIS6.0中部署ASP.NET应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用以下代码获取用户名:

txtName.Text = Environment.UserName;

我已经在IIS中部署了代码,并且在运行应用程序时得到了
用户名在文本框中为"NETWORK SERVICE",而不是登录的用户名.


在此先谢谢您.

Hi,

I am getting user name by using the following code:

txtName.Text = Environment.UserName;

I have deployed the code in IIS and while running the application then i am getting
user name as "NETWORK SERVICE" in the textbox instead of logged user name.


Thanks in advance.

推荐答案

使用User.Identity.Name获取登录用户的身份/名称.

但是,当您使用Windows身份验证并且在IIS中将"匿名身份验证"设置为false时,此方法适用.

请查看以下链接,以获取有关Asp.Net中" Windows身份验证"的更多信息.

http://msdn.microsoft.com/en-us/library/907hb5w9.aspx

http://msdn.microsoft.com/en-us/library/ff647076.aspx
Use User.Identity.Name to get Identity/Name of LoggedIn user.

However this is applicable when you are using Windows-Authentication and "Anonymous Authentication" is set to false in IIS.

Have a look at below links for more information on "Windows-Authentication" in Asp.Net.

http://msdn.microsoft.com/en-us/library/907hb5w9.aspx

http://msdn.microsoft.com/en-us/library/ff647076.aspx


这篇关于在IIS6.0中部署ASP.NET应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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