国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > .NET > 正文

c#.net如何獲取本機(jī)ip

2024-07-10 13:07:26
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

using system;
using system.collections;
using system.componentmodel;
using system.data;
using system.drawing;
using system.web;
using system.web.sessionstate;
using system.web.ui;
using system.web.ui.webcontrols;
using system.web.ui.htmlcontrols;
using system.net;

namespace webapplication5
{
 /// <summary>
 /// webform1 的摘要說(shuō)明。
 /// </summary>
 public class webform1 : system.web.ui.page
 {
  protected system.web.ui.webcontrols.textbox textbox1;
 
  private void page_load(object sender, system.eventargs e)
  {
   // 在此處放置用戶代碼以初始化頁(yè)面
   string   strhostip="";  
   iphostentry   oiphost=dns.resolve(environment.machinename);  
   if(oiphost.addresslist.length>0)  
    strhostip=oiphost.addresslist[0].tostring();  
   this.textbox1.text=strhostip;
  
  }

  #region web 窗體設(shè)計(jì)器生成的代碼
  override protected void oninit(eventargs e)
  {
   //
   // codegen: 該調(diào)用是 asp.net web 窗體設(shè)計(jì)器所必需的。
   //
   initializecomponent();
   base.oninit(e);
  }
 
  /// <summary>
  /// 設(shè)計(jì)器支持所需的方法 - 不要使用代碼編輯器修改
  /// 此方法的內(nèi)容。
  /// </summary>
  private void initializecomponent()
  {   
   this.load += new system.eventhandler(this.page_load);

  }
  #endregion
 }
}

 


trackback: http://tb.blog.csdn.net/trackback.aspx?postid=762769

[點(diǎn)擊此處收藏本文]   發(fā)表于 2006年05月30日 09:41:00

 


kwanhong 發(fā)表于2006-06-02 11:01:00  ip: 211.162.74.*
using system.net;

iphostentry localhost =
dns.gethostentry(dns.gethostname());

ipaddress address = localhost.addresslist[0];

console.writeline(address.tostring());

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 淳化县| 台南县| 改则县| 平南县| 尼勒克县| 辉南县| 连平县| 石城县| 鱼台县| 安图县| 云浮市| 阳西县| 修武县| 德兴市| 和顺县| 鹤庆县| 福清市| 乡宁县| 揭西县| 东兴市| 汉川市| 普格县| 武清区| 磐安县| 邻水| 南宫市| 游戏| 秦皇岛市| 郓城县| 淮北市| 海兴县| 和顺县| 若尔盖县| 会同县| 哈密市| 宝清县| 武宁县| 老河口市| 交口县| 青河县| 交口县|