後臺:
protected void Page_Load(object sender, EventArgs e)
{
//if (Session["admin_name"] == null || Session["admin_name"].ToString() == "")
//{
// Response.Write("<script language='javascript'>alert('滯留時間太久,請重新登陸……');window.parent.location.href='login.aspx';</script>");
//}
//獲取服務器IP
string name = Dns.GetHostName();
IPHostEntry myip = Dns.GetHostByName(name);
foreach (IPAddress ip in myip.AddressList)
{
this.LabIp.Text = ip.ToString();
}
//獲取名稱
string pcname = Dns.GetHostName();
this.LabName.Text = pcname.ToString();
//iis
this.LabIis.Text = Request.ServerVariables["SERVER_SOFTWARE"];
//時間
this.LabTime.Text = DateTime.Now.ToString();
//路徑
this.LabPatch.Text = Server.MapPath(Request.ServerVariables["SCRIPT_NAME"]);
//端口
this.Labdk.Text = Request.ServerVariables["SERVER_PORT"];
//系統
this.LabWin.Text = Environment.OSVersion.Platform.ToString() + " " + Environment.OSVersion.Version.ToString();
//超時
this.LabSe.Text = Server.ScriptTimeout.ToString();
}
獲取服務器上的ip:string ip = Request.ServerVariables.Get("Local_Addr").ToString();