It will be a little late, but it can help other people in the same situation, first create a new class for your proxy configuration, as shown below
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Web; namespace Your_name_space { public class Proxy : IWebProxy { public ICredentials Credentials { get { return new NetworkCredential("username", "password", "domaine"); } set { } } public Uri GetProxy(Uri destination) { return new Uri("your_proxy_address:port"); } public bool IsBypassed(Uri host) { return false; } } }
Then add this as a module to your application configuration in the config / system.net section.
<system.net> <defaultProxy enabled="true" useDefaultCredentials="false" > <module type="Your_name_space.Proxy , your_assembly_name" /> </defaultProxy> </system.net>
if you want to use the default session credentials, in the proxy class, replace this:
new NetworkCredential("username", "password", "domaine");
by
CredentialCache.DefaultCredentials;
Hope this helps.
source share