zoukankan      html  css  js  c++  java
  • [ZT]如何取得客户端的Windows登录用户名?

      1.   在ASP.NET中专用属性:  
      获取服务器电脑名:Page.Server.ManchineName  
      获取用户信息:this.User.Identity.Name     (IIS安全設置必須使用集成Windows驗證)
      获取客户端电脑名:Page.Request.UserHostName  
      获取客户端电脑IP:Page.Request.UserHostAddress  
       
      2.   在网络编程中的通用方法:  
      获取当前电脑名:static   System.Net.Dns.GetHostName()  
      根据电脑名取出全部IP地址:static   System.Net.Dns.Resolve(电脑名).AddressList  
      也可根据IP地址取出电脑名:static   System.Net.Dns.Resolve(IP地址).HostName  
       
      3.   系统环境类的通用属性:  
      当前电脑名:static   System.Environment.MachineName  
      当前电脑所属网域:static   System.Environment.UserDomainName  
      当前电脑用户:static   System.Environment.UserName  
  • 相关阅读:
    省选模拟17 题解
    省选模拟16 题解
    省选模拟15 题解
    省选模拟14 题解
    省选模拟13 题解
    省选模拟12 题解
    图论专项测试
    数学专题测试4
    省选模拟11 题解
    爬虫框架:scrapy
  • 原文地址:https://www.cnblogs.com/godwar/p/1298301.html
Copyright © 2011-2022 走看看