Scooter
unread,May 13, 2008, 9:42:47 AM5/13/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
I'm writing a simple C# app to check a list of websites every 5
minutes to see if they are up or not. I few of the sites are behind a
firewall. While I can get to them fine with my browser, wget, wfetch,
etc, when using my app I get a 504 Gateway timeout error. I can also
simply telnet to them via port 80 and get a connection. Only when
using my C# app do I get a failure. And my app, as well as the
successful hits mentioned previously were all run on the same pc, so
it shouldn't be a network issue:
I'm passing the url in as a parameter, and have printed it to debug
just to make sure its correct.
HttpWebRequest webRequest =
(HttpWebRequest)WebRequest.Create(thisURL);
webRequest.KeepAlive = false;
webRequest.Method = "GET";
try
{
webRequest.Timeout = 15000;
HttpWebResponse resp =
(HttpWebResponse)webRequest.GetResponse();
StreamReader responseReader = new
StreamReader(resp.GetResponseStream(), Encoding.UTF8);
String m_SiteData = responseReader.ReadToEnd();
resp.Close();
return m_SiteData;
}
catch (Exception ex)
{
System.Diagnostics.Debug.Print(thisURL);
System.Diagnostics.Debug.Print(ex.Message);
return "";
}
Any thoughts?