Can I specify the IP address that WebRequest should use when creating a connection to a remote resource? For example, I have an MVC 2 website that runs on IP 0.0.0.10, but the server has 0.0.0.1 - 0.0.0.10it assigned to it. There is a class on the website that will be initialized based on user input and will create requests for remote resources.
The problem that I encountered is that WebRequest most likely uses 0.0.0.1, since this is the first IP address of the server, and not the IP address of the website, which forces you to block requests from remote resources that are filtered by IP addresses ...
So, is there a way to specify the IP that WebRequest should use when executing the request. Alternatively, this should not be a solution for WebRequest, it could be a solution for HttpWebRequest or, if necessary, something else. If I have to change the code for requests / responses.
In any case, help would be greatly appreciated! Thanks in advance!
source
share