ASP.NET ashx获取客户端ip, 请求ip

ASP.NET ashx获取客户端ip, 请求ip
using System.Web;

namespace WebApplication6
{
    /// <summary>
    /// Summary description for Demo2
    /// </summary>
    public class Demo2 : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.Write("IP: " + context.Request.UserHostAddress.ToString());
            context.Response.Write("IP: " + HttpContext.Current.Request.UserHostAddress.ToString());
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}

作者最新文章
ASP.NET, ASP.NET Core WebApi 返回 Controller 返回 Json 类型结果
Visual Studio 调试 ASP.NET Core 无法连接 IIS Express 服务器
ASP.NET WebApi 与 ASP.NET Core WebApi 返回 HttpResponseMessage
SQL Server 中 CASE WHEN 使用
html table 设置表格背景图片,背景色