使用SharpPcap获取URL名称的问题 [英] Problem of getting the name of the URL using SharpPcap

查看:200
本文介绍了使用SharpPcap获取URL名称的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的先生们,



当用户打开任何网址时,我想从每个浏览器获取网址。我搜索过使用SharpPcap进行网络流量捕获。



我使用SharpPcap来获得解决方案,但是当我要打开Yahoo,google或其他任何链接时,先生本地PC它给了我所有的IP地址。



假设我从我的谷歌浏览器和我的C#.Net应用程序打开http://www.yahoo.com使用SharpPcap从后台线程运行。网站打开后,我检查了日志,它提供了大量的IP地址,这对我来说是不可理解的。



先生,我不需要任何IP地址。我只需要从我的电脑上打开URL的名称(如:yahoo.com)。



我想用C#做上述解决方案。净申请。



请帮我用C#代码获取解决方案。





感谢和问候

Dear Sirs,

I want to get the URL from each an every browser when user will open any URL from it. I have searched regarding web traffic capture using SharpPcap.

I have used SharpPcap to get the solutions but sir when i am going to open Yahoo, google or any other link in local PC it gives me all the IP Addresses.

Suppose I am opening http://www.yahoo.com from my google chrome browser and my C# .Net application with SharpPcap is running from background thread. After the site opened and I have checked the log it gives lots of IP Address which is not understandable to me.

Sir, I don't need any IP Address. I need only the name of the URL (like : yahoo.com) which will be opened from my PC.

I want to do the above solutions using my C# .Net application.

Please help me to get the solutions with C# code.


Thanks & Regards

推荐答案

您正在做的事情的问题是Web浏览器不会导航您在地址栏中键入的友好名称。他们将首先尝试将名称解析为IP地址,然后通过TCP / IP将HTTP GET请求发送到其中一个IP地址。



您永远不会看到导航到Web服务器时,友好的URL名称会穿过网络。为了获得友好名称,您必须将目的地字段中的IP地址提交给DNS,它将返回友好名称。





你也是这样做的。你已经被告知你必须以正确的方式做什么,这是一个代理服务器。
That problem with what you're doing is that web browsers do NOT navigate the friendly name you type in the address bar. They will first try to resolve the name to an IP address and then send a HTTP GET request over TCP/IP to one of those IP addresses.

You will NEVER see a friendly URL name go across the wire when navigating to a web server. In order to get something of a friendly name you have to submit the IP address in the Destination field to DNS and it will return the friendly name.


You're also doing this the wrong way. You were already told what you had to do to the this the correct way and that was a proxy server.


这篇关于使用SharpPcap获取URL名称的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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