How to set proxy Credentials to WebRequest ?
-
Hi, in my asp.net 1.1 application, i am sending request to another site, getting response from there. my code is
strUrl =" http://www.xyz.com/xyz.html"; WebRequest request = WebRequest.Create(strUrl); request.Credentials = CredentialCache.DefaultCredentials; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); if(response.StatusDescription == "OK") { //my logic here }
my problem is instead of Default Credentials, i want to give proxy userid, password to it. (because without proxy credentials i am unable to access the xyz.com) anybody give me solution for this?regards GV Ramana
-
Hi, in my asp.net 1.1 application, i am sending request to another site, getting response from there. my code is
strUrl =" http://www.xyz.com/xyz.html"; WebRequest request = WebRequest.Create(strUrl); request.Credentials = CredentialCache.DefaultCredentials; HttpWebResponse response = (HttpWebResponse)request.GetResponse(); if(response.StatusDescription == "OK") { //my logic here }
my problem is instead of Default Credentials, i want to give proxy userid, password to it. (because without proxy credentials i am unable to access the xyz.com) anybody give me solution for this?regards GV Ramana
Hi buddy, add the following code to supply ur username and password WebProxy myproxy=new WebProxy("proxy server IP",port); myproxy.Credentials=new NetworkCredential("user name","password","domain"); request.Proxy=myproxy; regards, abhishek:-> "If u believe in psychokinesis then raise my hand." :-)