This article introduces a simple example and description of cookie Programming in C #, and friends in Need can refer to the
copy code code as follows:
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; A summary description of the
namespace WebApplication5
{
///<summary>
///WebForm1.
///</summary>
public class WebForm1:System.Web.UI.Page
{
protected Sys Tem. Web.UI.WebControls.TextBox TextBox1;
private void Page_Load (object sender, System.EventArgs e)
{
//Place user code here to initialize page
string strhostip= "";
iphostentry oiphost= Dns.resolve (environment.machinename);
if (oiphost.addresslist.length>0)
strhostip=oiphost.addresslist[0]. ToString ();
this. Textbox1.text=strhostip;
}
#region The code generated by the Web Forms Designer
override protected void OnInit (EventArgs e)
{
//
//CodeGen: This call is required for the ASP.net Web forms Designer.
//
InitializeComponent ();
base. OnInit (e);
}
///<summary>
///Designer supports the desired method-do not use the Code Editor to modify
///The contents of this method.
///</summary>
private void InitializeComponent ()
{
this. Load + = new System.EventHandler (this. Page_Load);
}
#endregion
}
}