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 ...
随机推荐
- c++堆和栈(转)
想要学好C++的C++堆栈,那么就要了解什么是C++堆栈,所为C++堆栈就是一种数据项按序排列的数据结构,只能在一端(称为栈顶(top))对数据项进行插入和删除,分为堆和栈两部分. 在C++中,内存分 ...
- ---mipi command
可惜这是5.1系统: http://www.cnblogs.com/lialong1st/p/8534728.html
- vue项目tips
在main.js引入了封装好的各组件,包括echarts.自定义组件等
- 1503.02531-Distilling the Knowledge in a Neural Network.md
原来交叉熵还有一个tempature,这个tempature有如下的定义: \[ q_i=\frac{e^{z_i/T}}{\sum_j{e^{z_j/T}}} \] 其中T就是tempature,一 ...
- 【源】ensp 绑定本地网卡与仿真设备进行通信 场景下 仿真设备ping 不通 本机IP 问题
环境:Win7, ensp 1.2.00.500 问题现象:本机可以ping 通 仿真设备的接口IP,但是在仿真设备上 ping不通 本机接口ip. 问题处理:把本机win7系统只带的防火墙关闭后,在 ...
- .Net23种设计模式
C#常见的设计模式 一.概要: 模式分为三种,设计模式.体系结构模式与惯用法.其中惯用法是一种语言紧密相关的模式,例如,定界加锁模式其实是一种惯用法. 在C#项目开发过程中,很多情况下您已经使用了某些 ...
- 解决React Native:Error: Cannot find module 'asap/raw'
本来想做个底部切换的tab的,安装完 npm i react-native-tab-navigator --save 后跑项目就报错了,如下图 和我一样报这个错的朋友们莫慌,一步就可以解决了,执行命令 ...
- selenium使用技巧
标签(空格分隔): selenium 我们进行selenium的时候,就是通过webdriver,对浏览器做一些操作的: webdriver,除了find操作,之外还有哪些方法和属性呢? 1.获取当前 ...
- jquery的$(selector).each(function(index,element))和$.each(dataresource,function(index,element))的区别
$(selector).each(function(index,element)) 定义和用法 each() 方法规定为每个匹配元素规定运行的函数. $(selector).each(function ...
- webpack多入口优化
最近接手的项目是公司之前搭的多页面应用脚手架,然后到现在入口页面大大小小超过半百了,然后每次更新完配置之后,重启页面就贼拉卡,实在太影响开发效率了,于是开始优化呗. 最开始发现如果你想要让加载速度变快 ...