Bypassing proxy when using web services

That's how we do it in .NET:

ServiceNamespace.ServiceName client = new ServiceNamespace.ServiceName();
 
WebProxy proxy = null;

if (ConfigurationSettings.AppSettings["pUsername"] != "") 
{
  if (ConfigurationSettings.AppSettings["pPassword"] != "") 
  {
      NetworkCredential credentials = new NetworkCredential(
              ConfigurationSettings.AppSettings["pUsername"], 
              ConfigurationSettings.AppSettings["pPassword"], 
              ConfigurationSettings.AppSettings["pDomain"]
              ); 
      proxy = new WebProxy( 
              ConfigurationSettings.AppSettings["pIP"],
              int.Parse(ConfigurationSettings.AppSettings["pPort"]) 
              );
 
 
      proxy.Credentials = credentials;
  }
}
 
if (proxy != null)
 client.Proxy = proxy;

Post a Comment

Previous Post Next Post