get windows auth code
public static WindowsIdentityInfo GetWindowsIdentityInfo(HttpContext context)
{
WindowsIdentityInfo info = new WindowsIdentityInfo();
info.IsAuthenticated = false;
if (context==null)
{
WindowsPrincipal winPrincipal = (WindowsPrincipal)context.User;
if (winPrincipal != null)
{
info.IsAuthenticated = winPrincipal.Identity.IsAuthenticated;
info.UserName = winPrincipal.Identity.Name;
if (!string.IsNullOrEmpty(info.UserName))
{
string[] arr = info.UserName.Split('\\');
if (arr != null && arr.Length >= 2)
{
info.DisplayName = GetUserFullName(arr[0], arr[1]);
}
}
info.AuthenticationType = winPrincipal.Identity.AuthenticationType;
}
}
return info;
} private static string GetUserFullName(string domain, string userName)
{
DirectoryEntry userEntry = new DirectoryEntry("WinNT://" + domain + "/" + userName + ",User");
return (string)userEntry.Properties["fullname"].Value;
}
get windows auth code的更多相关文章
- 关于Windows® API Code Pack for Microsoft® .NET Framework
相比之前的操作系统,Window 7(or Vista)提供了很多新特性,我们在应用实现中可以利用这些特性来提升用户体验. 这些特性主要包括以下几个方面: Shell Enhancements Dir ...
- 利用 Windows API Code Pack 修改音乐的 ID3 信息
朋友由于抠门 SD 卡买小了,结果音乐太多放不下,又不舍得再买新卡,不得已决定重新转码,把音乐码率压低一点,牺牲点音质来换空间(用某些人的话说,反正不是搞音乐的,听不出差别)… 结果千千静听(百度音乐 ...
- loadrunner12: Error -27492: "HttpSendRequest" failed, Windows error code=8
这个问题我在网上看到有这样的解释:1.timeout时间超时设置问题2.Run-Time Settings -> Preferences -> Advanced. 确定此选项未被选中:&q ...
- 场景报错Error -27492: "HttpSendRequest" failed, Windows error code=12029 (cannot connect) and retry limit (0) exceeded for URL=""
1.现象:loadrunner场景执行,tps图是一段很平稳,然后直线触底,一段时间,直线恢复平稳,触底这段时间报错信息如下: Action.c(6): Error -27492: "Htt ...
- Windows VS Code 配置 C/C++ 开发环境
准备 Windows [这个相信大家都有 笑: )] VS Code MinGW-w64 C/C++ 安装 MinGw-w64 具体说明细节和安装体验可以在<⑨也懂系列:MinGW-w64安装教 ...
- Windows VS Code 配置 Java 开发环境
Windows VS Code 配置 C/C++ 开发环境 准备 Windows [这个相信大家都有 笑: )] VS Code JDK 建议 JDK8以上(不包含JDK8,关于 Windows环境下 ...
- Windows Error Code(windows错误代码详解)
0 操作成功完成. 1 功能错误. 2 系统找不到指定的文件. 3 系统找不到指定的路径. 4 系统无法打开文件. 5 拒绝访问. 6 句柄无效. 7 存储控制块被损坏. 8 存储空间不足,无法处理此 ...
- 【转】Windows Error Code(windows错误代码详解)
本文来自: http://blog.sina.com.cn/s/blog_5e45d1be0100i0dr.html http://blog.sina.com.cn/s/blog_5e45d1be01 ...
- Windows Locale Codes - Sortable list(具体一个语言里还可具体细分,中国是2052,法国是1036)
Windows Locale Codes - Sortable list NOTE: Code page is an outdated method for character encoding, y ...
随机推荐
- 关于spring boot 的事务类型配置留存
一.在声明式的事务处理中,要配置一个切面,其中就用到了propagation,表示打算对这些方法怎么使用事务,是用还是不用,其中propagation有七种配置,REQUIRED.SUPPORTS.M ...
- PHP通过身份证号码获取性别、出生日期、年龄等信息
$sex = substr($idcard, (strlen($idcard)==18 ? -2 : -1), 1) % 2 ? '1' : '2'; //18位身份证取性别,倒数第二位奇数是男,偶数 ...
- spring三大核心
IOC(控制反转) 下面是多个针对此理解的表达. 一个对象A依赖另一个对象B就要自己去new 这是高度耦合的 IOC容器的使用. 比如在B中使用A很多,哪一天A大量更改,那么B中就要修改好多代码. 通 ...
- 关于Eclipse for Python
学习Python一段时间,一直用Python的IDE进行开发,过程蛮顺利,但是,基于Visual Studio的使用经验,就希望尝试一种更友好的,更方便管理项目的IDE,分别尝试了PyCharm和Ec ...
- IDEA中使用中jetty启动java项目(非springboot)
1.安装maven helper插件,略 2.项目pom.xml文件中添加jetty插件配置 <build> <plugins> <plugin> <grou ...
- Taro开发微信小程序之初始化地图到当前位置
在componentDidMount中,初始化mapCtx. let _this = this this.mapCtx = Taro.createMapContext('container') //c ...
- php 安装最新的redis连接扩展
用于与redis连接的Php扩展[RC表示公测,我们用的是不带RC的稳定版本]下载包地址:http://pecl.php.net/package/redis 最新稳定版本:4.3.0 下载包:# wg ...
- Linux - 用户权限相关命令
用户权限相关命令 目标 用户 和 权限 的基本概念 用户管理 终端命令 组管理 终端命令 修改权限 终端命令 01. 用户 和 权限 的基本概念 1.1 基本概念 用户 是 Linux 系统工作中重要 ...
- 关于STM32CubeMX使用LL库设置PWM输出
HAL和LL库 HAL是ST为了实现代码在ST家族的MCU上的移植性,推出的一个库,称为硬件抽象层,很明显,这样做将会牺牲存储资源,所以项目最后的代码比较冗余,且运行效率大大降低,运行速度受制于fla ...
- Android判断一个点是否在矩形区域内
个人遇到的问题判断按钮的点击事件还是滑动事件 private boolean button1Down = false; private boolean button2Down = false; pri ...