.net 微信开发网页授权回调如何获取openid

已经获得code现在要访问
https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code”
返回的JSON数据包如下:

{
"access_token":"ACCESS_TOKEN",
"expires_in":7200,
"refresh_token":"REFRESH_TOKEN",
"openid":"OPENID",
"scope":"SCOPE"
}

现在要获取openid,怎么在后台访问这个链接回调后处理json数据,然后筛选出openid,直接赋给变量。
最终目的:string openid=回调后处理筛选好的openid。

HttpWebRequest请求那个地址获取返回的json数据然后前后截取或者建立json对应的类,用Newtonsoft.Json.Net20.dll序列化为你的类就可以访问了。

 using System;
using System.Web;
using System.Net;
using System.IO;
using System.Text;
public class HttpSend
{
     /// <summary>
    /// GET下载页面内容
    /// </summary>
    /// <param name="url">请求的地址</param>
    /// <param name="encoding">内容编码</param>
    /// <returns></returns>
    public static string GetPageContent(string url, Encoding encoding)
    {
        string html=null;
        try
        {
            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
            request.Method = "GET";

            HttpWebResponse response = request.GetResponse() as HttpWebResponse;
            Stream ioStream = response.GetResponseStream();
            StreamReader sr = new StreamReader(ioStream, encoding);
            html = sr.ReadToEnd();
            sr.Close();
            ioStream.Close();
            response.Close();
        }
        catch (Exception ex) {  }
        return html;
    }
}


//使用
string html=HttpSend.GetPageContent("你的qq oauth地址",Encoding.UTF8);
string key = "\"openid\":\"";
        int startIndex = html.IndexOf(key);
        if (startIndex != -1)
        {
            int endIndex = html.IndexOf("\",", startIndex);
            string openid = html.Substring(startIndex + key.Length, endIndex - startIndex - key.Length);
            Response.Write(openid);
        }
        else
        {//找不到openid,出错了。。
        }

我获取到的code怎么什么都没有呢

请问如何获取code