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的更多相关文章

  1. 关于Windows® API Code Pack for Microsoft® .NET Framework

    相比之前的操作系统,Window 7(or Vista)提供了很多新特性,我们在应用实现中可以利用这些特性来提升用户体验. 这些特性主要包括以下几个方面: Shell Enhancements Dir ...

  2. 利用 Windows API Code Pack 修改音乐的 ID3 信息

    朋友由于抠门 SD 卡买小了,结果音乐太多放不下,又不舍得再买新卡,不得已决定重新转码,把音乐码率压低一点,牺牲点音质来换空间(用某些人的话说,反正不是搞音乐的,听不出差别)… 结果千千静听(百度音乐 ...

  3. loadrunner12: Error -27492: "HttpSendRequest" failed, Windows error code=8

    这个问题我在网上看到有这样的解释:1.timeout时间超时设置问题2.Run-Time Settings -> Preferences -> Advanced. 确定此选项未被选中:&q ...

  4. 场景报错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 ...

  5. Windows VS Code 配置 C/C++ 开发环境

    准备 Windows [这个相信大家都有 笑: )] VS Code MinGW-w64 C/C++ 安装 MinGw-w64 具体说明细节和安装体验可以在<⑨也懂系列:MinGW-w64安装教 ...

  6. Windows VS Code 配置 Java 开发环境

    Windows VS Code 配置 C/C++ 开发环境 准备 Windows [这个相信大家都有 笑: )] VS Code JDK 建议 JDK8以上(不包含JDK8,关于 Windows环境下 ...

  7. Windows Error Code(windows错误代码详解)

    0 操作成功完成. 1 功能错误. 2 系统找不到指定的文件. 3 系统找不到指定的路径. 4 系统无法打开文件. 5 拒绝访问. 6 句柄无效. 7 存储控制块被损坏. 8 存储空间不足,无法处理此 ...

  8. 【转】Windows Error Code(windows错误代码详解)

    本文来自: http://blog.sina.com.cn/s/blog_5e45d1be0100i0dr.html http://blog.sina.com.cn/s/blog_5e45d1be01 ...

  9. Windows Locale Codes - Sortable list(具体一个语言里还可具体细分,中国是2052,法国是1036)

    Windows Locale Codes - Sortable list NOTE: Code page is an outdated method for character encoding, y ...

随机推荐

  1. Eclipse Tomcat部署web项目时出现There are no resources that can be added or removed from the server解决办法

    问题原因是:tomcat版本和java版本不匹配.

  2. java 启动报错 Unsupported major.minor version 52.

    这是java 版本问题,主要是版本不统一,你看看你开发工具用的java版本(编译的java版本和开发的java版本)是否统一,如果没有统一就会报这个错误.

  3. java面试题复习(六)

    51.实现多线程的方法 一种是继承Thread类:另一种是实现Runnable接口.两种方式都要通过重写run()方法来定义线程的行为,推荐使用后者,因为Java中的继承是单继承,一个类有一个父类,如 ...

  4. leetcode969

    class Solution(object): def pancakeSort(self, A: 'List[int]') -> 'List[int]': n = len(A) result = ...

  5. gitkraken clone报错 Configured SSH key is invalid

    gitkraken clone远程仓库时报错 Configured SSH key is invalid. Please confirm that is properly associated wit ...

  6. Linux 操作命令

    1. Linux 概述1.1. 内核版本    从技术角度来讲, Linux只是一个系统内核,一个内核并不是一套完整的操作系统.一套完整的操作系统应该包括内核. GNU应用程序库和工具.图形桌面环境等 ...

  7. 鱼骨时间轴案例(转自CSDN,原文链接附于文中)

    $.fn.fishBone = function(data) { var colors = ['#F89782','#1A84CE']; /**入口*/ //1.创建dom $(this).child ...

  8. AJAX请求方式

    <!DOCTYPE html PUBLIC "‐//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...

  9. vue+el-menu设置了router之后如何跳转到外部链接

    <el-menu class="sidebar-el-menu" :default-active="onRoutes" :collapse="c ...

  10. springboot+maven多模块工程dependency not found

    参见:https://blog.csdn.net/m0_37943753/article/details/81031319. 重点是<dependencyManagement>标签的作用, ...