public void GetAccess_Token()
{
string AppID = WebConfigurationManager.AppSettings.Get("AppID");
string AppSecret = WebConfigurationManager.AppSettings.Get("AppSecret");
string url =string.Format("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}",AppID,AppSecret);
System.Net.WebRequest wrq = System.Net.WebRequest.Create(url);
wrq.Method = "GET";
System.Net.WebResponse wrp = wrq.GetResponse();
System.IO.StreamReader sr = new System.IO.StreamReader(wrp.GetResponseStream(), System.Text.Encoding.GetEncoding("UTF-8"));
string strResult = sr.ReadToEnd();
//string strResult = "{\"access_token\":\"7_ORi8K6fA2wALPGycy_kEDcdV69SqZyjPfaBZRfU_ATPRXSvcan9K7cE7Ozv7BXsYg51rL0xYjsmQJvtiKEK0olkQFvcq6Qml7_kIfTiWbFHhk8TJsJKQLm4abLfY6PgXTRwwHYDYCM3fX0QBMQOhAAAQUS\",\"expires_in\":7200}";
string access_tokens = strResult.Split(',')[0].Split(':')[1];
access_token = access_tokens.Substring(1, access_tokens.Length - 2);
}
{
string AppID = WebConfigurationManager.AppSettings.Get("AppID");
string AppSecret = WebConfigurationManager.AppSettings.Get("AppSecret");
string url =string.Format("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}",AppID,AppSecret);
System.Net.WebRequest wrq = System.Net.WebRequest.Create(url);
wrq.Method = "GET";
System.Net.WebResponse wrp = wrq.GetResponse();
System.IO.StreamReader sr = new System.IO.StreamReader(wrp.GetResponseStream(), System.Text.Encoding.GetEncoding("UTF-8"));
string strResult = sr.ReadToEnd();
//string strResult = "{\"access_token\":\"7_ORi8K6fA2wALPGycy_kEDcdV69SqZyjPfaBZRfU_ATPRXSvcan9K7cE7Ozv7BXsYg51rL0xYjsmQJvtiKEK0olkQFvcq6Qml7_kIfTiWbFHhk8TJsJKQLm4abLfY6PgXTRwwHYDYCM3fX0QBMQOhAAAQUS\",\"expires_in\":7200}";
string access_tokens = strResult.Split(',')[0].Split(':')[1];
access_token = access_tokens.Substring(1, access_tokens.Length - 2);
}