Trying to GetResponse From a web site;
using System.Text;
using System.Net;
using System.IO;
namespace DutyPharmacy751013
{
class Program
{
static void
try with adding proxy credentials to request and also give network credentials
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.google.com/");
request.Credentials = new NetworkCredential("username", "pw");
WebProxy webProxy = new WebProxy("http://myproxy.net:8080/", true)
{
Credentials = new NetworkCredential("username", "pw"),
UseDefaultCredentials = false
};
request.Proxy = webProxy;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
//rest of the code...
For requests that you create, you can disable automatic proxy detection at the request level by using a null Proxy with your request
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.google.com/");
request.Proxy = null;
//rest of the code
WebProxy webProxy = new WebProxy("http://myproxy.net:8080/", true)
{
UseDefaultCredentials = false,
Credentials = new NetworkCredential("username", "pw")
};
Please note Correct sequence to set property {other wise failed for me}