hello all,
i just searched via google and found a set of codes to login to a web site using httpwebrequest. but whenever i tried using the codes i got the very same exception that
The remote server returned an error: (407) Proxy Authentication Required.
one of the sample code i ve used
ArrayList theQueryData = new ArrayList();
theQueryData.Add(String.Format("{0}={1}", "username", HttpUtility.UrlEncode("test")));
theQueryData.Add(String.Format("{0}={1}", "password", HttpUtility.UrlEncode("test")));
string Parameters = String.Join("&", (String[])theQueryData.ToArray(typeof(string)));
Uri url = new Uri("https://www.test.com/test/testlogin.cfm");
HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create(url);
webReq.ContentType = "application/x-www-form-urlencoded";
webReq.Method = "POST";
webReq.AllowWriteStreamBuffering = true;
webReq.AllowAutoRedirect = false;
webReq.Credentials = CredentialCache.DefaultCredentials;
webReq.CookieContainer = container;
webReq.CachePolicy = new RequestCachePolicy(RequestCacheLevel.NoCacheNoStore);
webReq.KeepAlive = true;
// We write the parameters into the request
StreamWriter sw = new StreamWriter(webReq.GetRequestStream());
sw.Write(Parameters);
sw.Close();
HttpWebResponse response = (HttpWebResponse)webReq.GetResponse();
response.Cookies = webReq.CookieContainer.GetCookies(webReq.RequestUri);
what should i do to get it work..
need help.