locked
URL Validation RRS feed

  • Question

  • User-1352439403 posted

    How I can check validation and existing of an URL ?

    Saturday, June 23, 2007 5:01 AM

Answers

  • User83354550 posted

     You could attempt retrieve a response from the URL like so.....

    string _url = http://www.google.com; 

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(_url);

    HttpWebResponse response = (HttpWebResponse)request.GetResponse();

    if (response == null)

    {

    // no response from URL

    }

    else

    {

    // response found.

    }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, June 23, 2007 11:07 AM
  • User-1352439403 posted

    Thank you very much Mr.Ankers

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, June 23, 2007 4:39 PM

All replies

  • User83354550 posted

     You could attempt retrieve a response from the URL like so.....

    string _url = http://www.google.com; 

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(_url);

    HttpWebResponse response = (HttpWebResponse)request.GetResponse();

    if (response == null)

    {

    // no response from URL

    }

    else

    {

    // response found.

    }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, June 23, 2007 11:07 AM
  • User-1352439403 posted

    Thank you very much Mr.Ankers

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, June 23, 2007 4:39 PM