0

I have a problem. Whenever I'm sending WebRequest to https://myaddress.com, it resolves to the wrong IP address (this domain has several IP adresses). How can I specify IP address, which I want to send the WebRequest to?

Thanks.

Augis
  • 1,903
  • 1
  • 16
  • 21

2 Answers2

0

Can't you use the IP directly? Example:

http://123.345.567.789/

WebRequest request = WebRequest.Create("http://123.345.567.789/");
Ted
  • 3,985
  • 1
  • 20
  • 33
  • Will work fine with http, may cause problems with https since the domain of the URL won't match the subject in the server certificate. – John Wu Oct 23 '13 at 00:32
0

Another way is you can edit the hosts file to avoid the DNS lookup: http://www.makeuseof.com/tag/6-surprising-uses-for-the-windows-hosts-file/

mikey
  • 5,090
  • 3
  • 24
  • 27