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

    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

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

  • 相关阅读:
    论财务的意义
    项目忙乱的原因
    回家的路
    但问耕耘
    做自己的主角
    坚持的意义
    觉醒的意义
    梦想的力量
    把自己当作一件艺术品
    九宫格年度计划
  • 原文地址:https://www.cnblogs.com/fast-michael/p/2057954.html
Copyright © 2011-2022 走看看