Linkchecker doesnt print any broken urls
<p>I'm having problems creating a linkchecker, I'd like to have it online mainly for learning..</p>

<p>The problem is that i first had it as a console application which worked kinda well (i got broken urls to show i debug console), now that i'm trying to get it to web I'm having trouble..</p>

<p>How do I go about getting this into the document? I'm kinda stumped at the moment..</p>

<pre><code>public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}


public bool UrlIsValid(string url)
{
try
{
    HttpWebRequest request = HttpWebRequest.Create(url) as HttpWebRequest;
    request.Timeout = 5000; //set the timeout to 5 seconds to keep the user from waiting too long for the page to load
    request.Method = "HEAD"; //Get only the header information -- no need to download any content

    HttpWebResponse response = request.GetResponse() as HttpWebResponse;

    int statusCode = (int)response.StatusCode;
    if (statusCode &gt;= 100 &amp;&amp; statusCode &lt; 400) //Good requests
    {
        return true;
    }
    else if (statusCode &gt;= 500 &amp;&amp; statusCode &lt;= 510) //Server Errors
    {
        string cl = (String.Format("The remote server has thrown an internal error. Url is not valid: {0}", url));
        // Debug.WriteLine(cl, Convert.ToString(url));

        return false;
    }
}
catch (WebException ex)
{
    if (ex.Status == WebExceptionStatus.ProtocolError) //400 errors
    {
        return false;
    }
    else
    {
        string cl = String.Format("Unhandled status [{0}] returned for url: {1}", ex.Status, url);
       /// Debug.WriteLine(cl, Convert.ToString(ex));

    }
}
catch (Exception ex)
{
    object cl = String.Format("Could not test url {0}.", url);
    Debug.WriteLine(cl, Convert.ToString(ex));
}
return false;
}

private void button1_Click(object sender, EventArgs e)
{
WebClient wc = new WebClient();

string checker = wc.DownloadString("http://administration.utbildningssidan.se/linkcheck.aspx");

while (checker.Contains("&lt;a href="))
{
    int checkstart = checker.IndexOf("&lt;a href=") + 8;
    int checkstop = checker.IndexOf("&gt;", checkstart);
    string validator = checker.Substring(checkstart, checkstop - checkstart);

    // perform the check
    if (!UrlIsValid(validator)) { Debug.WriteLine(validator); }

    checker = checker.Substring(checkstop + 1);
}
}
}
</code></pre>

<p>Hope you understand what I want accomplished, having a hard time making sense right now..</p>
