How to get content type of a web address?

.net, c#, c#-4.0, content-type

Solution

it should be something like this

    var request = HttpWebRequest.Create("http://www.google.com") as HttpWebRequest;
    if (request != null)
    {
        var response = request.GetResponse() as HttpWebResponse;

        string contentType = "";

        if (response != null)
            contentType = response.ContentType;
    }

Problem

I want to get type of a web address. For example this is a Html page and its page type is `text/html` but the type of this is `text/xml`. this page's type seems to be `image/png` but it's `text/html`. I want to know how can I detect the content type of a web address like this?

Original source

Related problems