关于微信授权和unionid 的获取思路。

1.首先根据appid 获取到预授权码的code

string Appid = "******";//appid。由于网页授权与js-jdk使用不同微信,所以暂时独立于此处。 string redirect_uri = "*********";//这里是回调地址的url string state = filterContext.HttpContext.Request.Url.ToString();//这里的state是 state = state.Replace("?", "|").Replace("&", "!!"); string url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + Appid + "&redirect_uri=" + redirect_uri + "&response_type=code&scope=snsapi_userinfo&state=" + state + "#wechat_redirect"; filterContext.HttpContext.Response.Redirect(url);

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zgzsws.html