zoukankan      html  css  js  c++  java
  • Get user name from the web client in Active Directories. [ No using Page.user]

     Usually we using the  Page.User.Identity.Name to get the web client user name . But if we are in the Active Directores enviroment and try to do this will be failed. So we need to set the web server like show in below firstly.

    Now the web server will replace the ISUER_MachineName login model as window authentication model which take the credentials from windows AD logged user.

    Finally, we can using 3 types of method to get the web-client user name.

     [1] System.Security.Principal.WindowsPrincipal p = System.Threading.Thread.CurrentPrincipal as System.Security.Principal.WindowsPrincipal;
                
    p.Identity.Name;
    [2] HttpContext.Current.User.Identity.Name.ToString();
    [3] Request.ServerVariables["AUTH_USER"].ToString();
  • 相关阅读:
    第一次作业
    第0次作业—姚舜禹17-1
    第三周作业
    第二周作业
    第一周作业
    第零周作业
    第三周作业
    第二周作业
    第一周作业
    第0次作业
  • 原文地址:https://www.cnblogs.com/zencorn/p/2016040.html
Copyright © 2011-2022 走看看