大家好,我用asp.net开发微信服务号,用户在微信客户端中访问第三方网页,我的授权回调域名如图:
然后我在http://a.bjfantu.cn/Default.aspx页面pageload中写代码:
//获取code接口地址
string getCodeStr = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=1111111&redirect_uri=a.bjfantu.cn&response_type=code&scope=snsapi_userinfo&state=STATE&connect_redirect=1#wechat_redirect";
string code = "";
try
{
code = Context.Request.QueryString["code"].ToString();
}
catch
{
Context.Response.Redirect(getCodeStr);
}
...... ........ .......
上面的代码的目的是要获取code,但每次打开Default.aspx页面的时候,会自动跳转到:https://open.weixin.qq.com/connect/oauth2/a.bjfantu.cn?code=1111111111&state=STATE
等于是打开default.aspx(假设是A)页面会跳到B页面,而B又重定向到了另一个C页面,而重定向到的C页面的链接中有我要取的code值,问题:我怎么在A中就可以获取到code?因为我不可能到C页面中去取值