HttpWebRequest to different IP than the domain resolves to

Posted by fyjham on Stack Overflow See other posts from Stack Overflow or by fyjham
Published on 2010-03-17T22:26:14Z Indexed on 2010/03/17 22:31 UTC
Read the original article Hit count: 652

Filed under:
|
|
|

Hey,

Long story short an API I'm calling's different environments (dev/staging/uat/live) is set up by putting a host-record on the server so the live domain resolves to their other server in for the HTTP request.

The problem is that they've done this with so many different environments that we don't have enough servers to use the server-wide host files for it anymore (We've got some environments running off the same servers - luckily not dev and live though :P).

I'm wondering if there's a way to make WebRequest request to a domain but explicitly specify the IP of the server it should connect to? Or is there any way of doing this short of going all the way down to socket connections (Which I'd really prefer not to waste time/create bugs by trying to re-implementing the HTTP protocol).

PS: I've tried and we can't just get a new sub-domain for each environment.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET