下面是获取公众号的授权,注意的是 公众号授权与网页授权不一样的 获取到后 缓存起来 保存2小时
string url2 = string.Format( "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}", WeiXinPay.WxConfig.appid, WeiXinPay.WxConfig.appsecret); string returnStr2 = HttpGet.PageGet(url2, null, "text/HTML"); var obj2 = JsonConvert.DeserializeObject(returnStr2); if (obj2 != null && obj2.access_token != "") { if (PayCenter.getCache("wxModelAccess") != null) { PayCenter.removeCache("wxModelAccess"); } PayCenter.addCache("wxModelAccess", obj2.access_token, 2); }