Below is the example code that you can pass proxy server url
HttpWebRequest webRequest = null; string strResult = null; try { // Create a new web request webRequest = WebRequest.Create(url) as HttpWebRequest; // Check if ProxyServerUrl in the appSettings is not empty if (!string.IsNullOrEmpty(WebConfigurationManager.AppSettings["ProxyServerUrl"].ToString())) { // instantiate a new WebProxy class and send the ProxyServerUrl to the contructor parameter System.Net.WebProxy proxy = new System.Net.WebProxy(WebConfigurationManager.AppSettings["ProxyServerUrl"].ToString(),
true); // Set the proxy credentials proxy.Credentials = new NetworkCredential(WebConfigurationManager.AppSettings["PassThroughUser"].ToString(),
WebConfigurationManager.AppSettings["PassThroughPwd"].ToString()); // Set the WebRequest proxy property by the WebProxy class already configured webRequest.Proxy = proxy; } // Read the response using (StreamReader sr = new StreamReader(webRequest.GetResponse().GetResponseStream())) { // Set strResult to the response strResult = sr.ReadToEnd(); } } catch { }
Image may be NSFW.
Clik here to view.

Clik here to view.
