HttpWebRequest/Reponse and VPN - 03-21-2006 , 03:41 PM
I am working on a kind of a "stand alone" m\c where in i have to connect
using VPN to get into our company's network.
I created a webpage on my local machine (WinXP) and was trying to use
HttpWebRequest/HttpWebResponse object to read other site feeds. However, i am
always getting "Underlying connection is closed" or "operation timed out"
errors. The same code works fine if i call any Localhost URL, but not working
as expected for internet URLs.
My doubt here is, if IE is able to access any site, why can't i don the same
with my code.
I have tried to create a WebProxy as well (though my IE is not using any
proxy to connect to internet) by providing the VPN's IP. It did not work. Can
someone please let me know what is wrong with the below code.
HttpWebRequest rssReq = (HttpWebRequest)HttpWebRequest.Create(new
rssReq.UserAgent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;
..NET CLR 1.1.4322)";
rssReq.Timeout = 30000;
WebProxy webprox=new WebProxy("xx.xxx.xxx.xx");
//rssReq.Proxy = System.Net.WebProxy.GetDefaultProxy();
System.Net.CredentialCache SuperUserCredentials = new
new System.Net.NetworkCredential("naresh.mirkhelkar"," pwd","domain")
webprox.Credentials = SuperUserCredentials;
rssReq.Proxy = webprox;
//rssReq.Credentials = SuperUserCredentials;
rssReq.Credentials = nc;
rssReq.KeepAlive = false;
HttpWebResponse response = (HttpWebResponse)rssReq.GetResponse();
//Get the Response Stream from the URL
Stream responseStream = response.GetResponseStream();
Note: Please let me know or redirect this mail to the right alias if this is
not the right one for such issues.
|Thread Tools||Search this Thread|