.NETクライアント情報の取得

7610 ワード

protected void Page_Load(object sender, EventArgs e)
    {
            string info = "   IP:" + Page.Request.UserHostAddress;
            info += "<br/>    :" + Page.User;
            info += "<br/>       :" + Page.Server.MachineName;
            info += "<br/>        :" + System.Net.Dns.GetHostName();
            info += "<br/>     :" + System.Environment.MachineName;
            info += "<br/>        :" + System.Environment.UserDomainName;
            info += "<br/>      :" + System.Environment.UserName;
            info += "<hr/>";
            info += "<br/>     :" + Request.Browser.Browser;
            info += "<br/>     :" + Request.Browser.Id;
            info += "<br/>      :" + Request.Browser.Version;
            info += "<br/>          :" + Request.Browser.Beta;
            info += "<hr/>";
            info += "<br/>        :" + Request.Browser.Platform;
            info += "<br/>   win16  :" + Request.Browser.Win16;
            info += "<br/>   win32  :" + Request.Browser.Win32;
            Response.Write(info);
            Response.End();   

    }

    string     !     

      :

System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append(string.Format("    : {0}", Server.HtmlEncode(DateTime.Now.ToString())));
sb.Append("<br />");
sb.Append(string.Format("         : {0}",Server.HtmlEncode(Request.CurrentExecutionFilePath)));
sb.Append("<br />");
sb.Append(string.Format("              : {0}", Server.HtmlEncode(Request.ApplicationPath)));
sb.Append("<br />");
sb.Append(string.Format("         : {0}",Server.HtmlEncode(Request.FilePath)));
sb.Append("<br />");
sb.Append(string.Format("         : {0}",Server.HtmlEncode(Request.Path)));
sb.Append("<br />");
sb.Append(string.Format("                          : {0}", Server.HtmlEncode(Request.PhysicalApplicationPath)));
sb.Append("<br />");
sb.Append(string.Format("       URL             : {0}", Server.HtmlEncode(Request.PhysicalApplicationPath)));
sb.Append("<br />");
Response.Write(sb.ToString());