protected void Page_Load(object sender, EventArgs e) { access_token = WeXinLib.GetAccessToken(appid, secret); api_ticket = WeXinLib.GetWXJSAPITicket(access_token); timestamp = WeXinLib.CreateTimeStamp().ToString(); nonceStr = WeXinLib.CreateNonceStr(); url = Request.Url.ToString(); signature = WeXinLib.CreateSignature(api_ticket, nonceStr, timestamp, url); }
protected void btnSubmit_Click(object sender, EventArgs e) { this.lblaccess_token.Text = WeXinLib.GetAccessToken(this.txtAppid.Text.Trim(), this.txtSecret.Text.Trim()); this.lbljsapi_ticket.Text = WeXinLib.GetWXJSAPITicket(this.lblaccess_token.Text); this.lbltimestamp.Text = WeXinLib.CreateTimeStamp().ToString(); this.lblnonceStr.Text = WeXinLib.CreateNonceStr(); this.lblurl.Text = Request.Url.ToString(); this.lblsignature.Text = WeXinLib.CreateSignature(lbljsapi_ticket.Text, lblnonceStr.Text, lbltimestamp.Text, lblurl.Text); }