A problem when using HttpWebRequest
-
private string GetWebContent() { string fullpath = @"http://www.google.com"; HttpWebRequest webreq = (HttpWebRequest)System.Net.WebRequest.Create(fullpath); HttpWebResponse webresp = (HttpWebResponse)webreq.GetResponse(); StreamReader strm = new StreamReader(webresp.GetResponseStream(), Encoding.ASCII); String text = strm.ReadToEnd(); strm.Close(); return text; } This is my code. it works well on my own computer, but when i put in my office computer, there is a WebException: "The underlying connection was closed: Unable to connect to the remote server." why? is it because the setting of firewall in the office server or something. Thanks very much:laugh:
-
private string GetWebContent() { string fullpath = @"http://www.google.com"; HttpWebRequest webreq = (HttpWebRequest)System.Net.WebRequest.Create(fullpath); HttpWebResponse webresp = (HttpWebResponse)webreq.GetResponse(); StreamReader strm = new StreamReader(webresp.GetResponseStream(), Encoding.ASCII); String text = strm.ReadToEnd(); strm.Close(); return text; } This is my code. it works well on my own computer, but when i put in my office computer, there is a WebException: "The underlying connection was closed: Unable to connect to the remote server." why? is it because the setting of firewall in the office server or something. Thanks very much:laugh:
It uses system IE settings. Are you able to use google.com in your office computer. And IE profiles might interfere too. :)
Vasudevan Deepak Kumar Personal Homepage namespace LavanyaDeepak
Personal Weblog
The World of Deepak and Lavanya
Views and Reviews -
It uses system IE settings. Are you able to use google.com in your office computer. And IE profiles might interfere too. :)
Vasudevan Deepak Kumar Personal Homepage namespace LavanyaDeepak
Personal Weblog
The World of Deepak and Lavanya
Views and ReviewsThanks. i can use www.google.com in my office computer through IE. and i do not understand "And IE profiles might interfere too" could you explain it for me, and how to fix it then? :(