本实例主要介绍如何使用Request对象的UserHostAddress属性来获取客户端的IP地址。 主要代码如下: protected void Button2_Click(object sender, EventArgs e) { TextBox2.Text = Request.UserHostAddress; }