/// <summary> /// 获取JS-SDK配置信息 /// </summary> /// <param name="url">url(当前网页的URL,不包含#及其后面部分,要用Request.Url.AbsoluteUri,否则会存在编码问题)</param> /// <returns></returns> public static WeChatHelper4Net.Models.JSSDK.JSSDKConfig GetJSConfig(string url) { string appId = ConfigurationManager.AppSettings["WeChatAppId"].ToString(); //AppId为空时默认取配置文件appSettings节点key=WeChatAppId string jsapi_ticket = Models.WeChatTokenOrTicket.GetJSApiTicket().ticket; var JsConfig = JSSDK.GetConfig(appId, jsapi_ticket, url); return(JsConfig); }
public string weixintoken() { WinXinConfig config = new WinXinConfig(); string appId = System.Configuration.ConfigurationManager.AppSettings["WeChatAppId"]; string appSecret = System.Configuration.ConfigurationManager.AppSettings["WeChatAppSecret"]; bool debug = System.Configuration.ConfigurationManager.AppSettings["WeChatAppDebug"].ToLower() == "true"; JSSDK sdk = new JSSDK(appId, appSecret, debug); config = sdk.GetConfig(); return(config.accesstoken); }
public void GetWeiXinMsg() { WinXinConfig config = new WinXinConfig(); string appId = System.Configuration.ConfigurationManager.AppSettings["WeChatAppId"]; string appSecret = System.Configuration.ConfigurationManager.AppSettings["WeChatAppSecret"]; bool debug = System.Configuration.ConfigurationManager.AppSettings["WeChatAppDebug"].ToLower() == "true"; JSSDK sdk = new JSSDK(appId, appSecret, debug); config = sdk.GetConfig(); if (config != null) { LogUtil.Log("获取微信Config出错", "appid:" + appId + ",appSecret:" + appSecret + ",debug:" + debug + ",token:"); ViewBag.WeiXinConfig = config; } else { ViewBag.WeiXinConfig = new WinXinConfig(); } }