Here is some of the code I'm using to try to connect to "http://msdn.microsoft.com/rss.xml
." Unfortunately, I'm behind a proxy. It connects to web pages in our intranet but nothing outside. I was getting a (407) Proxy Authentication Required error before, but I think I've fixed that. I'm currently getting a error "The underlying connection was closed. The remote name could not be resolved."
Any suggestions would be appreciated. :)
private void button1_Click(object sender, System.EventArgs e)
string html = GetPageHTML(txtURL.Text, 10);
txtHTML.Text = html;
public string GetPageHTML(string pageUrl, int timeoutSeconds)
WebResponse response = null;
// Setup of proxy - should pull default settings from IE?
WebProxy proxyObject = WebProxy.GetDefaultProxy()
// Also tried this...
//WebProxy proxyObject = new WebProxy("myproxyaddress",
t = proxyObject;
// Setup Web request
WebRequest request = WebRequest.Create(pageUrl)
request.PreAuthenticate = true; //Do I need this?
request.Proxy = GlobalProxySelection.GetEm
request.Credentials = new NetworkCredential("usernam
request.Timeout = (timeoutSeconds * 1000);
// Retrieve data from request
// *** crashes on this step***
response = request.GetResponse();
// go on to read xml, etc...
catch (Exception ex)
// Error occured grabbing data, return empty string.
MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
// Check if exists, then close the response.
if ( response != null )