The remote server returned an error: (401) Unauthorized
<p>I'm trying to get the access token from the windows live connect api by using this code</p>

<p>string requestUrl = "https://consent.live.com/AccessToken.aspx";</p>

<pre><code>        // Request the access token.
        string postData = string.Format("{0}?wrap_client_id={1}&amp;wrap_client_secret={2}&amp;wrap_callback={3}&amp;wrap_verification_code={4}&amp;idtype={5}",
                requestUrl,
               "000000004C039809",
                "l4VJekL1vFL1iFVmcP5qLkWv9ukY4mdl",
                "http://ewshops.com",
                "dac5d71d-d640-30d1-ebed-3576b132b3ec",
                "cid");
        byte[] postDataEncoded = System.Text.Encoding.UTF8.GetBytes(postData);

        WebRequest req = HttpWebRequest.Create(requestUrl);
        req.Method = "POST";
       // req.
        req.ContentType = "application/x-www-form-urlencoded";
        req.ContentLength = postDataEncoded.Length;


        Stream requestStream = req.GetRequestStream();
        requestStream.Write(postDataEncoded, 0, postDataEncoded.Length);

        WebResponse res = req.GetResponse();

        string responseBody = null;

        using (StreamReader sr = new StreamReader(res.GetResponseStream(), Encoding.UTF8))
        {
            responseBody = sr.ReadToEnd();
        }

        // Process FORM POST.
        NameValueCollection responseCollection = System.Web.HttpUtility.ParseQueryString(responseBody);

        return responseCollection["wrap_access_token"];
</code></pre>

<p>but I've recieved the following error</p>

<p>The remote server returned an error: (401) Unauthorized.</p>
