UserHostAddress in Asp.net Core

后端 未结 4 1028
挽巷
挽巷 2020-12-13 17:50

What is the equivalent in Asp.Net Core of the old HttpContext.Request.UserHostAddress?

I tried this.ActionContext.HttpContext but cannot fi

4条回答
  •  猫巷女王i
    2020-12-13 18:29

    For aspnet rc1-update1 I found IP(with port) in X-Forwarded-For header, which's value can be accessed from controller as HttpContext.Request.Headers["X-Forwarded-For"].FirstOrDefault().

提交回复
热议问题