using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Net; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Xml; using NetLibrary.Log; using Newtonsoft.Json; namespace TradeManage.WeiXin { public partial class weixinauth : System.Web.UI.Page { static string OpenId = ""; public int UId = -2; const string Token = "qianyun"; //你的token static string appId = "wx2f5849d8aa573da3";//公众号的appId static string appSecret = "34cc0ed309a8250eed74ea4df0b59fb5";//公众号的appSecret static string code = ""; static string appUrl = "https://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code"; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { if ((Server.UrlDecode(Page.Request.QueryString["OpenId"]) != null) && (Server.UrlDecode(Page.Request.QueryString["OpenId"]) != "")) { OpenId = Server.UrlDecode(Page.Request.QueryString["OpenId"]); ErrorFollow.TraceWrite("OpenId", "", OpenId); //PostPage(); } } catch (Exception ex) { ErrorFollow.TraceWrite("PostPage", "PostPage", ex.Message); //写日志 return; } } } } }