Hi,
I have a windows form app that initially reads a single line of data from a text file on a remote web server
I have been using webclient component to do this and it appears to work very well.
However, I encountered an issue today when running it on a site where I didn't have any internet access (actually didn't have authentication against the proxy server)
Basically, the app couldn't access the file on the web server.
The same problem will obviously occur if my remote web server is down or temporarily unavailable.
As such, I would like to build in a routine to check if the remote web server exists first.
If the web server didn't exist, then I'd like a separate routine to run.
I've been trying to do this using a timeout. I.e. if the remote web server doesn't respond within 10 seconds, then fire my other routine.
I've therefore changed my webclient component to httpwebrequest.
I have put a timeout in as well and that works fine.
However, I can't for the life of see how to manage this connection.
I was expecting to find a httpwebrequest.status to tell me whether or not I was connected to the web server.
How should I go about determining whether or not i've made a connection to a webserver, or whether the timeout has been reached?
Thank you
I have a windows form app that initially reads a single line of data from a text file on a remote web server
I have been using webclient component to do this and it appears to work very well.
However, I encountered an issue today when running it on a site where I didn't have any internet access (actually didn't have authentication against the proxy server)
Basically, the app couldn't access the file on the web server.
The same problem will obviously occur if my remote web server is down or temporarily unavailable.
As such, I would like to build in a routine to check if the remote web server exists first.
If the web server didn't exist, then I'd like a separate routine to run.
I've been trying to do this using a timeout. I.e. if the remote web server doesn't respond within 10 seconds, then fire my other routine.
I've therefore changed my webclient component to httpwebrequest.
I have put a timeout in as well and that works fine.
However, I can't for the life of see how to manage this connection.
I was expecting to find a httpwebrequest.status to tell me whether or not I was connected to the web server.
How should I go about determining whether or not i've made a connection to a webserver, or whether the timeout has been reached?
Thank you