C# – How to set proxy settings for the application in .NET


I have an application in C# which uses a service reference to send SMS through a web service. The user's internet connection needs to pass through a proxy server in order to reach the world.

So my question is how to tell .NET to call web service through the proxy? Or how to set proxy settings for internet connection of my application just like what you can do in YMahoo Messenger?

Also I want to let user to choose proxy settings.

Best Solution

I believe what you are looking for is defaultProxy in your config file.

Here's an example from the link:

        <add address="[a-z]+\.contoso\.com" />