zoukankan      html  css  js  c++  java
  • 转:通过ASP.Net页面获取域用户名(当前登陆的用户)

    通过ASP.Net页面获取域用户名(当前登陆的用户)

    原文地址: https://www.cnblogs.com/fast-michael/archive/2011/03/14/2057954.html
    复制代码
    1 string domainAndName = Page.User.Identity.Name;
    2 string[] infoes = domainAndName.Split(new char[1] { '\' }, StringSplitOptions.RemoveEmptyEntries);
    3 string userDomainName = "";
    4 string userName = "";
    5 if (infoes.Length > 1)
    6 {
    7 userDomainName = infoes[0];
    8 userName = infoes[1];
    9 }
    复制代码

    需要注意的地方(可能出现问题的地方已经解决方案):

    1.将IIS Authentication设置为:Windows Authentication,并且只有这一项

    2.在ASP.Net的Web.Config中添加:<identity impersonate="true"/> <authentication mode="Windows"/>

    3.发布到IIS后,将Application Pool选择为Classic的

    4.将IIS的 ISAPI and CGI Restrictions设置为Allowed

    以上是查阅很多资料之后总结的心得。

  • 相关阅读:
    主函数main
    static关键字
    this关键字
    构造函数
    封装
    匿名对象
    java基础积累
    JAVA相关知识复习
    ORACLE数据库表空间查询
    两个日期的时间差
  • 原文地址:https://www.cnblogs.com/BinBinGo/p/9899664.html
Copyright © 2011-2022 走看看