从的HTTPHeader请求IP地址 [英] ip address of request from httpheader
问题描述
我试图让从未来的HTTPHeader在请求的IP地址。如果值为x做一些事情,如果不做别的财产以后。谁能帮我?
I am trying to get the IP address of the request coming in from the httpheader. If value is x do something, if not do somthing else. Can anyone help me out?
推荐答案
您可能想要的看这里。在HTTP标准不作为协议的一部分限定的源地址。逸岸HTTP并不直接涉及到的IPv4 / IPv6的。
You might want to look here. The HTTP standards do not define the source address as part of the protocol. Infact HTTP does not directly relate to IPv4 /IPv6 at all.
一般情况下,Web服务器将能够轻松地告诉插座的另一端的网络地址(结束,其中网络浏览器是)。它不使用HTTP来做到这一点,而是将使用操作系统的网络协议栈的功能。
Generally, a webserver will easily be able to tell the network address of the other end of the socket ( the end where the web browser is ). It does not use HTTP to do this, rather it will use features of the OS's networking stack.
在ASP.NET的情况下,你应该能够找到IP解决那里的请求来到。你可以尝试寻找 System.Web.HttpRequest.UserHostAddress
In the case of ASP.NET you should be able to find the IP address where the request came from. You might try looking at System.Web.HttpRequest.UserHostAddress
这篇关于从的HTTPHeader请求IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!