johnllao

October 31, 2008

Webservice Proxy Authentication

Filed under: Uncategorized — johnllao @ 5:12 pm

Here is a sample code that shows how to authenticate public web service request for proxy authenticated networks. The CountryProxy object I generated using wsdl.exe from http://www.webservicex.net/WCF/default.aspx

 

    /// <summary>
    /// 
    /// </summary>
    public class Program
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="args"></param>
        public static void Main(string[] args)
        {
            WebProxy proxy = new WebProxy("proxy_address");
            proxy.Credentials = new NetworkCredential("username", "password", "domain"); ;

            Country cty = new Country();
            cty.Proxy = proxy;

            string countries = cty.GetCountries();
            Console.WriteLine(countries);

            Console.ReadLine();
        }
    }

No Comments Yet »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

You must be logged in to post a comment.

Blog at WordPress.com.