G
Guest
Hi,
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.
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
Uri("http://www.quotationspage.com/data/mqotd.rss"));
rssReq.Method="GET";
rssReq.UserAgent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;
..NET CLR 1.1.4322)";
//rssReq.Headers.Add("Translate","t");
rssReq.Timeout = 30000;
rssReq.ContentType="text/xml";
rssReq.ProtocolVersion=HttpVersion.Version10;
WebProxy webprox=new WebProxy("xx.xxx.xxx.xx");
//rssReq.Proxy = System.Net.WebProxy.GetDefaultProxy();
NetworkCredential nc=new
NetworkCredential("naresh.mirkhelkar","pwd","domain");
System.Net.CredentialCache SuperUserCredentials = new
System.Net.CredentialCache();
SuperUserCredentials.Add( new
System.Uri("http://www.quotationspage.com/data/mqotd.rss"),
"NTLM",
new System.Net.NetworkCredential("naresh.mirkhelkar","pwd","domain")
);
webprox.Credentials = SuperUserCredentials;
rssReq.Proxy = webprox;
//rssReq.Credentials = SuperUserCredentials;
rssReq.Credentials = nc;
rssReq.KeepAlive = false;
//-------FAILING HERE------------
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.
Thanks,
Naresh
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.
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
Uri("http://www.quotationspage.com/data/mqotd.rss"));
rssReq.Method="GET";
rssReq.UserAgent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;
..NET CLR 1.1.4322)";
//rssReq.Headers.Add("Translate","t");
rssReq.Timeout = 30000;
rssReq.ContentType="text/xml";
rssReq.ProtocolVersion=HttpVersion.Version10;
WebProxy webprox=new WebProxy("xx.xxx.xxx.xx");
//rssReq.Proxy = System.Net.WebProxy.GetDefaultProxy();
NetworkCredential nc=new
NetworkCredential("naresh.mirkhelkar","pwd","domain");
System.Net.CredentialCache SuperUserCredentials = new
System.Net.CredentialCache();
SuperUserCredentials.Add( new
System.Uri("http://www.quotationspage.com/data/mqotd.rss"),
"NTLM",
new System.Net.NetworkCredential("naresh.mirkhelkar","pwd","domain")
);
webprox.Credentials = SuperUserCredentials;
rssReq.Proxy = webprox;
//rssReq.Credentials = SuperUserCredentials;
rssReq.Credentials = nc;
rssReq.KeepAlive = false;
//-------FAILING HERE------------
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.
Thanks,
Naresh