顯示服務器信息

 

 

 

 

後臺:

 

 

 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();

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

發佈了41 篇原創文章 · 獲贊 3 · 訪問量 3萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章