乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      ASP.NET獲取IP及電腦名等信息的簡單方法 通用類文件源碼 (轉(zhuǎn)載) - 《八零年代》...

       命運(yùn)之輪 2007-07-27
      1. 在ASP.NET 中專用屬性:
      獲取服務(wù)器電腦名:Page.Server.ManchineName
      獲取用戶信息:Page.User
      獲取客戶端電腦名:Page.Request.UserHostName
      獲取客戶端電腦IP:Page.Request.UserHostAddress

      2. 在網(wǎng)絡(luò)編程中的通用方法:
      獲取當(dāng)前電腦名:static System.Net.Dns.GetHostName()
      根據(jù)電腦名取出全部IP地址:static System.Net.Dns.Resolve(電腦名).AddressList
      也可根據(jù)IP地址取出電腦名:static System.Net.Dns.Resolve(IP地址).HostName

      3. 系統(tǒng)環(huán)境類的通用屬性:
      當(dāng)前電腦名:static System.Environment.MachineName
      當(dāng)前電腦所屬網(wǎng)域:static System.Environment.UserDomainName
      當(dāng)前電腦用戶:static System.Environment.UserName


      一個(gè)獲取本機(jī)內(nèi)網(wǎng)和外網(wǎng)IP的公用類 

      using System;
      using System.IO;
      using System.Net;
      using System.Text;
      using System.Text.RegularExpressions;
      namespace ipip
      {
       /// <summary>
       /// Class1 的摘要說明。
       /// 獲取本機(jī)上網(wǎng)IP和內(nèi)網(wǎng)IP
       /// </summary>
       public class Class1
       {
       
        private string strgetIP;
        
        public Class1()
        {  
        netIP();
        getIP(); 
        }
        
       
        public string renetIP()
        {return netIP();}//返回網(wǎng)絡(luò)IP

        public string regetIP()
        {return strgetIP;}//返回內(nèi)網(wǎng)IP

        
        static string netIP()
        {
         Uri uri = new Uri("http://www./ip/index.asp");//查本機(jī)網(wǎng)絡(luò)IP的網(wǎng)頁
         HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uri);
         req.Method = "POST";
         req.ContentType = "application/x-www-form-urlencoded";
         req.ContentLength = 0;
         req.CookieContainer = new CookieContainer();
         req.GetRequestStream().Write(new byte [0], 0, 0);
         HttpWebResponse res = (HttpWebResponse)(req.GetResponse());
         StreamReader rs = new StreamReader(res.GetResponseStream(), Encoding.GetEncoding("GB18030"));
         string s = rs.ReadToEnd();
         rs.Close();
         req.Abort();
         res.Close();
         Match m = Regex.Match(s, @"IP:\[(?<IP>[0-9\.]*)\]");
         if (m.Success) return m.Groups["IP"].Value;
         string strnetIP= string.Empty;
         return strnetIP;
        }

        public string getIP()//注意與static 的區(qū)別
        {
         System.Net.IPAddress[] addressList = Dns.GetHostByName(Dns.GetHostName()).AddressList;//獲取本機(jī)內(nèi)網(wǎng)IP
        

          strgetIP = addressList[0].ToString();
          return strgetIP;
         
        }  
       }
      }

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多