Using C# to get web page information
-
Hey guys I am hoping you can help with this. I am writting a windows service that monitors servers and reports back to an asp page which collects the data and displays it in a grid which notifies us if a server is up or down. Recently we started writting an asp page that holds certain configuration data, one being the web url(which is used for check in). And my question for you guys is how do I tell my service to check that asp page every so often to see if the web url has changed, and if it has changed pull the new url and use that for the check in. I hope that made sense. I look forward to hearing what you guys have to say. And thanks in adavance to everyone that helps Travis
-
Hey guys I am hoping you can help with this. I am writting a windows service that monitors servers and reports back to an asp page which collects the data and displays it in a grid which notifies us if a server is up or down. Recently we started writting an asp page that holds certain configuration data, one being the web url(which is used for check in). And my question for you guys is how do I tell my service to check that asp page every so often to see if the web url has changed, and if it has changed pull the new url and use that for the check in. I hope that made sense. I look forward to hearing what you guys have to say. And thanks in adavance to everyone that helps Travis
tcombs07 wrote:
And my question for you guys is how do I tell my service to check that asp page every so often to see if the web url has changed,
You shall use WebRequest[^] and WebResponse[^] classes. Using these, you can send request to the remote URI and get the status. So if you are getting a 404 message, you need to pull new URL and resend the request to there.
All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia How to use google | Ask smart questions