您的位置:首页 > 编程语言 > ASP

ASP.NET 获取客户端访问端口

2013-06-10 12:43 381 查看
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{

    private void Page_Load(object sender, System.EventArgs e)
    {
        System.Collections.Specialized.NameValueCollection coll = Request.ServerVariables;

        foreach (string key in coll.AllKeys)
        {
            foreach (string value in coll.GetValues(key))
            {
                Response.Write(key + "------" + value + "<br/>");
            }
        }

        string port = Request.ServerVariables["REMOTE_PORT"].ToString();
        Response.Write(port);

    }

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: