Q:

How can I better my URL checker program?

I made a LinkChecker program which checks URLs from a text file and outputs status into another file like this:

http://valid-url.com;OK
http://invalid-url.com;The remote server returned an error: (404) Not Found.

I have about 1400 URLs in the input file and it takes about 12 minutes to run. 
I made it work. In what ways can I achieve rightness and fastness?
public class LinkChecker
{
    static void Main()
    {
        string line = string.Empty;
        string inputFile = @"D:\tmp\links.txt";
        StreamReader file = new StreamReader(inputFile);
        string outputFile = @"D:\tmp\out.txt";

        ClearOutputFile(outputFile);

        while(!string.IsNullOrEmpty(line = file.ReadLine()))
        {
            string currentUrlAndStatus = CheckURL(line);
            if(!string.IsNullOrEmpty(currentUrlAndStatus))
            {
                WriteToFile(currentUrlStatus, outputFile);
            }
        }
    }

    private static string CheckURL(string url)
    {
        string status = string.Empty;

        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
        request.Method = "HEAD";
        request.Proxy = null;

        try
        {
            using(HttpWebResponse response = (HttpWebResponse)request.GetResponse())
            {
                status = response.StatusCode.ToString();
            }
        }
        catch (WebException ex)
        {
            status = ex.Status;
        }

        return url + ";" + status;
    }

    private static void ClearOutputFile(string file)
    {
        using (Filestream fileStream = File.Open(file, FileMode.Open)
        {
            fileStream.SetLength(0);
        }
    }

    private static void WriteToFile(string message, string filename)
    {
        using(var writer = new StreamWriter(filename, true))
        {
            writer.WriteLine(message);
        }
    }
}

A:

You forgot using using in your StreamReader
    using(StreamReader file = new StreamReader(inputFile)){
    string outputFile = @"D:\tmp\out.txt";

    ClearOutputFile(outputFile);

    while(!string.IsNullOrEmpty(line = file.ReadLine()))
    {
        string currentUrlAndStatus = CheckURL(line);
        if(!string.IsNullOrEmpty(currentUrlAndStatus))
        {
            WriteToFile(currentUrlStatus, outputFile);
        }
    }
  }

Use the var keyword for local variables, let the compiler figure out the type for you. Type inference helps in refactoring.
 var line = string.Empty;
 var inputFile = @"D:\tmp\links.txt";
 using(var file = new StreamReader(inputFile)){
 //...
 }
 var outputFile = @"D:\tmp\out.txt";
 // etc..

A:

It takes 12 minutes because it has to wait for a request response on every URL, one by one. If you want it to go faster, it's better to load all URLs from your file into an array of strings first, then run a number of threads so you can check multiple URLs simultaneously. Wait for all threads to finish before writing it back to a file.
More on threading in C# here:
http://msdn.microsoft.com/en-us/library/aa645740%28v=vs.71%29.aspx

A:

Read entire file at first then start async web requests, it shouldn't take more than a minute or two. Time depends on file size, your and server's bandwidth etc. 
Why Async?
There are servers slower/faster than others, or even some servers may return a timeout which will take "much time", to avoid them you should start web requests async. and handle their completed event to write results to file.  IMFO writing line by line or first in-memory and flush will effect performance

