Selecting outgoing addredd in HttpWebRequest [SOLVED]
C#
1
Posts
1
Posters
0
Views
1
Watching
-
Hello to everyone! I'm trying to implement selection of outgoing IP address in HttpWebRequest.. I've found this piece of code:
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri); request.ServicePoint.BindIPEndPointDelegate = new BindIPEndPoint(Bind); static IPEndPoint Bind(ServicePoint servicePoint, IPEndPoint remoteEndPoint, int retryCount) { IPAddress address = IPAddress.Parse("192.168.1.6"); return new IPEndPoint(address, 8888); }
Everything is ok but only for the first time. When I create the second HttpWebRequest to the same uri,
Bind(...)
is not called. Is there any workaround? Thanks in advance. == update == I have solved it. If anyone is interested, you need to add the code:request.KeepAlive = false;
Die Energie der Welt ist konstant. Die Entropie der Welt strebt einem Maximum zu.
modified on Tuesday, February 23, 2010 9:24 AM