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());
新聞熱點(diǎn)
疑難解答
圖片精選