OAuth授权出现少数人报 40029错误,一直授权不成功。贴上代码,求大神指教。
if (LWRequest.GetString("code") != "")
{
OAuthUserInfo infos = null;
try
{
DataTable result = GetToken(LWRequest.GetString("code"), Appid, Ksy);
if (result.Columns.Contains("errcode"))
{
Prompt("" + result.Rows[0]["errmsg"].ToString());
return;
}
infos = OAuthApi.GetUserInfo(result.Rows[0]["access_token"].ToString(), result.Rows[0]["openid"].ToString());
}
catch
{
Response.Redirect("/500error.html");
}
if (infos != null)
{
}
}
else
{
string u = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + Appid + "&redirect_uri=" + System.Web.HttpContext.Current.Server.UrlEncode(url) + "&response_type=code&scope=snsapi_userinfo&state=1&connect_redirect=1#wechat_redirect";
Response.Redirect(u);
}