HttpWebRequest and local IPEndPoint

  • Thread starter Thread starter José Vilaça
  • Start date Start date
J

José Vilaça

Greetings.

I need to perform a HttpWebRequest originating from a well known local
IPEndPoint. In particular, I need to use the same port number every time and
I need to specify that port number. However, I can't find how to access the
underlying Socket for the HttpWebRequest. Is it possible? Or will I have to
use Socket directly and forget about HttpWebRequest?

Thanks in advance for your help.

José Vilaça
 
Yes, HttpWebRequest does not expose the underlying Socket.

Why is there the requirement for the request to come from a well known local
endpoint ?

feroze
======================
This posting is provided as-is. It offers no guarantees and confers no
rights.

======================
 
Why is there the requirement for the request to come from a well known
local
endpoint ?

The service I'm trying to access imposes this limitation. It will only reply
to connections originating from registered IP:Port. The service provider
imposes this restriction.

I didn't want to implement an http client using sockets... HttpWebRequest
works just fine, except for this service, that repeatedly refuses my
requests with an unauthorized application message.

José Vilaça
 
has anyone found a solution to this problem? i too am hesitant to implement
http myself :) but i need access to information in the communication such as
the source and destination port numbers.

chris
 
has anyone found a solution to this problem? i too am hesitant to implement
http myself :) but i need access to information in the communication such
as the source and destination port numbers.

chris
 
Unfortunately, there is no way to do this with HttpWebRequest.

Why does the server force you to come from a specific IP:Port combination ?
It is easy to meet the IP requirement (by running your client on a machine
which has the correct IP) but not possible to set the port (with
Httpwebrequest).

--
feroze

-----------------
This posting is provided as-is. It offers no warranties and assigns no
rights.

See http://weblogs.asp.net/feroze_daud for System.Net related posts.
----------------
 
I too have a requirement (customer not mine) in a multi nic machine to
specific the ip address / port to use to recieve the response to a
HttpWebRequest.GetResponse( )

Is there an msft newsgroup monitor that might take on pursuing this
internally?
I have a feeling that its going to be a very common enterprise scenario....
-john
 
ive worked around this by implementing the comm, not with httpwebrequest,
but with a c# adaptation of the winhttp api, it wasnt that bad to do and
since the framework was getting in the way by having "protected
headers"(wtf?), it was all i could do
 
Back
Top