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

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

  • 相关阅读:
    ejs
    appcan.slider.js探索
    js语法重点
    canvas动画
    canvas绘图
    Bootstrap 表单
    模态框
    Node.js EventEmitter(事件队列)
    Node.js 事件循环
    react native 页面跳转
  • 原文地址:https://www.cnblogs.com/fast-michael/p/2057954.html
Copyright © 2011-2022 走看看