473,378 Members | 1,346 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Why there is no option to set the source (local) address for HttpWebRequest?

Hello

I am writing a HTTP client, that will run on a computer with multiple IP
addresses. I want to bind the TCP socket for the HTTP connection to a
specific IP address, but unfortunately there is no option to do this in
System.Net.HttpWebRequest class. I looked for that option a lot, I even
looked at the ROTOR source code to if there is a private member that I can
access with reflection but didn't find anything. (I know this is not right
because internal implementation may change in the future, but I am
desperate)

I couldn't find HTTP clients for .NET that provide this option, and I have
no time to implement my own. I think this is a design flaw, that makes the
developer reimplement a whole set of classes in order to make such a minor
modification.

I suggest adding an event that it fired after the creation of the TCP socket
and before the connection is established so that the user can bind to a
localaddress or set other socket options, or even better a socket factory
class ( a class responsible for creating sockets for all connections
(HTTP/FTP/SMTP etc)) and a configuration option so that the user can provide
his/her own socket factory class.

Best regards,
Sherif
Nov 16 '05 #1
2 1868
Sherif,

Using an event for this kind of configuration would be a bigger design
flaw. You could have multiple event handlers vying for the configuration.
A better idea would be to provide an interface implementation which would
configure options.

If you want to make a suggestion, the best place to do it would be the
MSDN Product Feedback Home, located at:

http://lab.msdn.microsoft.com/produc...k/default.aspx

You can input your request there, and if others see it, then they can
vote on it as well, and you can get some feedback from MS as well on the
issue.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Sherif ElMetainy" <el*************@wayout.net.NOSPAM> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hello

I am writing a HTTP client, that will run on a computer with multiple IP
addresses. I want to bind the TCP socket for the HTTP connection to a
specific IP address, but unfortunately there is no option to do this in
System.Net.HttpWebRequest class. I looked for that option a lot, I even
looked at the ROTOR source code to if there is a private member that I can
access with reflection but didn't find anything. (I know this is not right
because internal implementation may change in the future, but I am
desperate)

I couldn't find HTTP clients for .NET that provide this option, and I have
no time to implement my own. I think this is a design flaw, that makes the
developer reimplement a whole set of classes in order to make such a minor
modification.

I suggest adding an event that it fired after the creation of the TCP
socket
and before the connection is established so that the user can bind to a
localaddress or set other socket options, or even better a socket factory
class ( a class responsible for creating sockets for all connections
(HTTP/FTP/SMTP etc)) and a configuration option so that the user can
provide
his/her own socket factory class.

Best regards,
Sherif

Nov 16 '05 #2
Thanks

I submitted a suggestion there

Best regards,
Sherif

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:OS**************@TK2MSFTNGP10.phx.gbl...
Sherif,

Using an event for this kind of configuration would be a bigger design
flaw. You could have multiple event handlers vying for the configuration.
A better idea would be to provide an interface implementation which would
configure options.

If you want to make a suggestion, the best place to do it would be the
MSDN Product Feedback Home, located at:

http://lab.msdn.microsoft.com/produc...k/default.aspx

You can input your request there, and if others see it, then they can
vote on it as well, and you can get some feedback from MS as well on the
issue.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Sherif ElMetainy" <el*************@wayout.net.NOSPAM> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hello

I am writing a HTTP client, that will run on a computer with multiple IP
addresses. I want to bind the TCP socket for the HTTP connection to a
specific IP address, but unfortunately there is no option to do this in
System.Net.HttpWebRequest class. I looked for that option a lot, I even
looked at the ROTOR source code to if there is a private member that I can access with reflection but didn't find anything. (I know this is not right because internal implementation may change in the future, but I am
desperate)

I couldn't find HTTP clients for .NET that provide this option, and I have no time to implement my own. I think this is a design flaw, that makes the developer reimplement a whole set of classes in order to make such a minor modification.

I suggest adding an event that it fired after the creation of the TCP
socket
and before the connection is established so that the user can bind to a
localaddress or set other socket options, or even better a socket factory class ( a class responsible for creating sockets for all connections
(HTTP/FTP/SMTP etc)) and a configuration option so that the user can
provide
his/her own socket factory class.

Best regards,
Sherif


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Nicolae Fieraru | last post by:
Hi All, I use VC .Net 2003 and I want to create a small program which is able to read the source code of a web site. I have a textbox with the URL, a button and a multiline textbox for the...
1
by: Drew | last post by:
Can I construct an HttpWebRequest with a local file instead of a URL? It seems like I remember doing this in Java with something like "file:\\\myfile.txt" in place of the URL. Thanks, Drew
0
by: Abhishek Srivastava | last post by:
Hello All, How do I completly and totally disable any kind of caching when making a HttpWebRequest. I have an application which downloads a file from the web. This file is updated on a daily...
24
by: ej1002 | last post by:
Hi I have developed a Windows Application(C# Windows Form) which will get the IFrame Source of the page it is navigating using Webbrowser Control. Now I want do this in ASP.Net web application(C#...
8
by: DEWright_CA | last post by:
Why does WebClient.DownloadFile loose my completed path? Ok, I have a function in my app then when my button is clicked it checks to see if the files come from a local drive or a http address....
3
by: Elliot M. Rodriguez | last post by:
This line raises a precompiler error when Option Strict is turned on: Dim objRequest As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(m_SearchURL) The error: Option Strict On...
2
by: jens Jensen | last post by:
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(ConfigurationManager.AppSettings); req.Proxy = new System.Net.WebProxy(ConfigurationManager.AppSettings, true); req.ContentType =...
1
by: Ezz | last post by:
I have an interesting problem...and its one of those where I know what I want but don't know how to ask it =) I have an eCommerce application that uses Paypal for its payment gateway. It is an...
3
by: Maksim Kasimov | last post by:
Hi, how to set source ip-address when do __socket.connect((host, port)) on a machine that have a several ip-adresses? many thanks for advice. __socket = socket.socket(socket.AF_INET,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.