知识大全 asp.net获得客户端域账号

Posted

篇首语:知识比金钱宝贵,比刀剑锋利,比枪炮威力大。本文由小常识网(cha138.com)小编为大家整理,主要介绍了知识大全 asp.net获得客户端域账号相关的知识,希望对你有一定的参考价值。

  To get the windows user name through programatically Compulsary we need to set the web server

  Open the Internet Infomation Services(IIS) Select your ASP NET Virtual Directory right click go to the Properties In Properties window go to Directory Security Tab Here You Find the Edit button in Anonymous access and Authentication Control Press Edit Button Now Authentication Methods dialogbox will appear

  In this dialog box by default it is set(checked) Anonymous Access uncheck this checkbox and go to botom of this dialog box check the Integrated windows authentication Here why we are selecting this Default web server is logged by ISUER_MachineName so if it is window authentication web server will take the credentials from windows logged user

  Getting the User Name :

  using three ways we can get the User Name using C#

   ) System Security Principal WindowsPrincipal p = System Threading Thread CurrentPrincipal as System Security Principal WindowsPrincipal;

  string strName = p Identity Name;

  [ OR ]

   ) string strName = HttpContext Current User Identity Name ToString();

  [ OR ]

   ) string strName = Request ServerVariables[ AUTH_USER ]; //Finding with name

  string strName = Request ServerVariables[ ]; //Finding with index

  In Above Cases returnin string contains DomainName\\WinNTLoggedUserName

  (for Ex: Microsoft\\Bill Gates Here Microsoft is domain Bill Gates is Logger User Name )

cha138/Article/program/net/201311/13941

相关参考

知识大全 ASP.NET后台代码实现XmlHttp跨域访问

ASP.NET后台代码实现XmlHttp跨域访问  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  

知识大全 ASP.NET程序员应用程序域须知

ASP.NET程序员应用程序域须知  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  本文将讨论NE

知识大全 ASP.NET入门教程 9.5 变量的作用域和生存期

ASP.NET入门教程9.5变量的作用域和生存期  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!&n

知识大全 Asp.net直接保存文件到客户端

Asp.net直接保存文件到客户端  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  在我们的系统的

知识大全 asp.net向客户端注册JavaScript脚本

asp.net向客户端注册JavaScript脚本  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! 

知识大全 以 Cassini 来宿主 ASP. NET 客户端

以Cassini来宿主ASP.NET客户端  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  早在年

知识大全 Asp.Net 2.0自带的客户端回调

Asp.Net2.0自带的客户端回调  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  AspNet

知识大全 asp.net获取客户端IP地址网卡

asp.net获取客户端IP地址网卡  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! &n

知识大全 ASP.NET之精通客户端弹出窗口

ASP.NET之精通客户端弹出窗口  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  作为Micro

知识大全 ASP.NET AJAX客户端组件初探

ASP.NETAJAX客户端组件初探  以下文字资料是由(全榜网网www.cha138.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧!  以组件的思想