Can I know if a website is down or does not exist with C #? [closed]

-1

Cordial Greeting.

Today's question is: Can I know if a page exists or is dropped using c # (or another that recommend)?

Recently I have seen the need to monitor a website to know whether it is available or dropped, I have researched and I have not found anything interesting or useful.

I appreciate it.

    
asked by Andros 30.07.2018 в 15:08
source

1 answer

0

to know if the web is down:

        WebRequest request = WebRequest.Create("http://www.google.com");
        try
        {
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            if (response == null || response.StatusCode != HttpStatusCode.OK)
            {
                MessageBox.Show("web caida");
            }
        }
        catch
        {
            MessageBox.Show("webMUYcaida");
        }

to monitor for that there are already many options

from making a windows service that looks at the web page every time or a scheduled task of windows that executes an application every time, that is already your own decision.

    
answered by 30.07.2018 / 21:23
source