获取在ASP.NET域用户ID [英] Get Domain User ID in ASP.NET

查看:121
本文介绍了获取在ASP.NET域用户ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ASP.NET应用程序,其中员工登录到Windows,然后他们必须从名称的长列表中选择他们的名字和登录到应用程序。

I have a ASP.NET application where an employee logs into Windows and then they have to select their name from a long list of names and log in into the application.

我想做的事情只要员工打开它,从下拉框选择他们的名字申请。

What I want to do is as soon as the employee opens the application it selects their name from the drop down box.

我相信,如果我能在页面加载获得Windows用户ID然后我可以让我的code选择取决于所登录的Windows用户的用户。

I believe if I can get the Windows User Id on page load I can then make my code select the user depending on the Windows user that is logged in.

问题。你如何获得当前在C#Asp.net登录的Windows用户ID?任何想法。

Question is. How do you get Windows User Id that is currently logged in in C# Asp.net? Any ideas.

推荐答案

试试这个: -

System.Web.HttpContext.Current.User.Identity.Name

另外,请查阅此论坛

更新: -

1)请检查您是否在IIS中禁用匿名模式

1) Please check that you have disabled anonymous mode in IIS

2)也做检查已设置为autheticate用户详细信息如下应用: -

2) Also do check that you have set the application to autheticate the user details like this:-

 <authentication mode="Windows"/> 
    <authorization> 
       <allow users="*"/>
    </authorization>

或像这样: -

  <authentication mode="Windows" /> 
     <authorization> 
        <deny users="?"/> 
     </authorization>

3)您可以您可以在控制面板中配置IIS使您的网站(或计算机)使用Windows身份验证,并拒绝匿名访问

3) You can you can either configure IIS in Control Panel so that your site (or machine) uses Windows authentication and denies anonymous access

这篇关于获取在ASP.NET域用户ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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