简体   繁体   English

获取请求Rss Feed C#的应用名称/网址

[英]Get App Names/Urls Requesting Rss Feed C#

I have a site that has an Rss feed, and this feed is consumed and redisplayed on a number of different sites. 我有一个具有Rss提要的网站,该提要已被使用并在许多不同的网站上重新显示。

Everytime the RSS feed is requested, I want to get the Url of the website requesting and re-displaying it. 每当请求RSS feed时,我都希望获得请求并重新显示它的网站的网址。 I have tried using 'Request.UrlReferrer' but this does not work? 我尝试使用“ Request.UrlReferrer”,但这不起作用?

I hope this makes sense, but to break it down. 我希望这是有道理的,但请分解。

Site A has the RSS feed 站点A具有RSS feed

Site B reads in the RSS feed and does something with it 站点B读入RSS feed并对其进行处理

I want to catch the Url of Site B and store it in Site A somewhere so I can see what websites are using the RSS feed. 我想了解站点B的网址并将其存储在站点A中的某个位置,以便查看哪些网站正在使用RSS feed。

Is this possible? 这可能吗?

You could use the Request.UserHostAddress property on site A to get the IP of the client sending the HTTP request. 您可以使用站点A上的Request.UserHostAddress属性来获取发送HTTP请求的客户端的IP。

Of course if you are running in a web farm and your web servers are behind a load balancer or a proxy this will give you the IP address of the load balancer and not the client. 当然,如果您在Web场中运行,并且Web服务器位于负载均衡器或代理之后,则将为您提供负载均衡器的IP地址,而不是客户端的IP地址。 Hopefully your proxy server is configured to use the X-FORWARDED-FOR HTTP request header which ports the original client IP address. 希望您的代理服务器配置为使用X-FORWARDED-FOR HTTP请求标头,该标头可移植原始客户端IP地址。 So if this is your case you could use Request.Headers["X-FORWARDED-FOR"] . 因此,如果您遇到这种情况,可以使用Request.Headers["X-FORWARDED-FOR"]

Depending on your requirements, yet another possibility is to simply exploit the IIS log files on Site A which contain all requests and their client IP addresses. 根据您的要求,另一种可能性是简单地利用站点A上的IIS日志文件,其中包含所有请求及其客户端IP地址。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM