如何在MVC中获取X-forwarded-for值 [英] How to get X-forwarded-for value in MVC

查看:91
本文介绍了如何在MVC中获取X-forwarded-for值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从请求标头X-FORWARDED-FOR中检索值,它总是返回null,有人可以告诉我如何获得X-FORWARDED-FOR的值。其实我需要客户端系统的原始(公共)IP地址



我尝试过:



I am trying to retrieve value from request header X-FORWARDED-FOR its always returning null, can someone tell me how can we get the value of X-FORWARDED-FOR. Actually I need original(public) ip address of client system

What I have tried:

I am trying to retrieve value from request header X-FORWARDED-FOR its always returning null, can someone tell me how can we get the value of X-FORWARDED-FOR. Actually I need original ip address of client system

推荐答案

ServerVariables [ ^ ]和标题 [ ^ ] ...

您应该在以后查找...
There is a difference between ServerVariables[^] and Headers[^]...
You should look for it in the later...


这篇关于如何在MVC中获取X-forwarded-for值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆