62,074
社区成员
发帖
与我相关
我的任务
分享
JsApiPay jsApiPay = new JsApiPay(this);
try
{
//调用【网页授权获取用户信息】接口获取用户的openid和access_token
jsApiPay.GetOpenidAndAccessToken();
//获取收货地址js函数入口参数
wxEditAddrParam = jsApiPay.GetEditAddressParameters();
Session["openid"] = jsApiPay.openid;
Response.Write("openid:" + jsApiPay.openid);
}
catch (Exception ex)
{
Response.Write("<span style='color:#FF0000;font-size:15px'>" + "页面加载出错,请重试" + "</span>");
}
//添加Session
Session["Vip"] = ds.Tables[0].Rows[0]["Accname"].ToString();
Session["VipId"] = ds.Tables[0].Rows[0]["Id"].ToString();
Session.Timeout = 600;
//将OpenID存入用户信息中
if (ds.Tables[0].Rows[0]["Openid"].ToString() == "" && Session["Openid"] != null && Session["Openid"].ToString() != "")
{
Bll.InsertVipOpenid(Convert.ToInt32(Session["VipId"].ToString()), Session["Openid"].ToString());
}
//获取用户的角色
string userdata = txtUserName.Text;
// 创建身份验证票证
FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, txtUserName.Text, DateTime.Now, DateTime.Now.AddMinutes(360), true, userdata);
string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
// 创建Cookie
HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
Response.Cookies.Remove("authCookie");
Response.Cookies.Add(authCookie);
//Response.Write(Context.User.Identity.Name);
//将用户重定向到最初请求页面。
Response.Redirect("Index.aspx",true);
将Response.Redirect("Index.aspx",true);改为Response.Redirect("publish.aspx");
换一个页面跳转也是出现同样的错误。
上述调试都只能通过官方提供的微信web开发者工具,所以没法定位问题出在哪。
//添加Session
Session["Vip"] = ds.Tables[0].Rows[0]["Accname"].ToString();
Session["VipId"] = ds.Tables[0].Rows[0]["Id"].ToString();
Session.Timeout = 600;
//将OpenID存入用户信息中
if (ds.Tables[0].Rows[0]["Openid"].ToString() == "" && Session["Openid"] != null && Session["Openid"].ToString() != "")
{
Bll.InsertVipOpenid(Convert.ToInt32(Session["VipId"].ToString()), Session["Openid"].ToString());
}
//获取用户的角色
string userdata = txtUserName.Text;
// 创建身份验证票证
FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, txtUserName.Text, DateTime.Now, DateTime.Now.AddMinutes(360), true, userdata);
string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
// 创建Cookie
HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
Response.Cookies.Remove("authCookie");
Response.Cookies.Add(authCookie);
//Response.Write(Context.User.Identity.Name);
//将用户重定向到最初请求页面。
Response.Redirect("Index.aspx",true);