HTTP请求 - 不使用DNS [净] [英] Http Request - Bypass DNS [.Net]

查看:172
本文介绍了HTTP请求 - 不使用DNS [净]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能(如果是,如何)做一个HTTP请求时,可以绕过DNS?

Is it possible (and if yes, how) to bypass DNS when doing a HTTP request ?

我想直接打一个前端带有一个HTTP请求,而无需通过NLB但与正确的主机头得到。 因为我有我的服务器的IP,我只需要绕过DNS。

I want to hit directly a front-end with an HTTP request, without getting through NLB but with the correct host header. As I have the IP of my server, I just need to bypass the DNS.

我试图用WebRequest的,IP地址替换URL和设置主机头,但这个头是受保护的。

I tried to use WebRequest, replacing the URL with the IP and setting the Host header, but this header is protected.

我怎么能这样做?我是否需要创建HTTP请求自己?

How can I do that ? Do I need to create the HTTP request myself ?

注:编辑主机文件是不是一种选择

Note: editing host file is not an option

推荐答案

我能做到什么,我需要代理服务器设置到远程服务器的IP地址:

I manage to do what I need setting the proxy to the IP address of the remote server :

request.Proxy = new WebProxy(ip.ToString());

它不会在所有情况下工作,但它在我的情况一样。

It doesn't work in all scenarios, but it did in my case.

这篇关于HTTP请求 - 不使用DNS [净]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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