手机版使用余额支付 提示信息跳转到PC版的错误
引起错误的原因是中间需要提交到DTcms.Webapipaymentalanceindex.aspx去处理
导致BasePage.cs中的linkurl方法中 string requestPath = HttpContext.Current.Request.RawUrl.ToLower(); //当前的URL地址
获取到的地址为:/api/payment/balance/index.aspx
解决方法:
1、BasePage.cs中重写linkurl
/// <summary> /// 自定义:余额支付专用:返回URL重写统一链接地址 /// </summary> public string linkurlpay(string _key, params object[] _params) { Hashtable ht = new BLL.url_rewrite().GetList(); //获得URL配置列表 Model.url_rewrite model = ht[_key] as Model.url_rewrite; //查找指定的URL配置节点 //如果不存在该节点则返回空字符串 if (model == null) { return string.Empty; } string UrlReferrer = string.Empty; if (HttpContext.Current.Request.UrlReferrer != null) UrlReferrer = HttpContext.Current.Request.UrlReferrer.ToString().ToLower(); //来源URL地址 string requestDomain = HttpContext.Current.Request.Url.Authority.ToLower(); //获得来源域名含端口号 string requestPath = HttpContext.Current.Request.RawUrl.ToLower(); //当前的URL地址 UrlReferrer=UrlReferrer.Replace(requestDomain, "").Replace("http://",""); string linkStartString = GetLinkStartString(UrlReferrer, requestDomain); //链接前缀 //如果URL字典表达式不需要重写则直接返回 if (model.url_rewrite_items.Count == 0) { //检查网站重写状态 if (config.staticstatus > 0) { if (_params.Length > 0) { return linkStartString + GetUrlExtension(model.page, config.staticextension) + string.Format("{0}", _params); } else { return linkStartString + GetUrlExtension(model.page, config.staticextension); } } else { if (_params.Length > 0) { return linkStartString + model.page + string.Format("{0}", _params); } else { return linkStartString + model.page; } } } //否则检查该URL配置节点下的子节点 foreach (Model.url_rewrite_item item in model.url_rewrite_items) { //如果参数个数匹配 if (IsUrlMatch(item, _params)) { //检查网站重写状态 if (config.staticstatus > 0) { return linkStartString + string.Format(GetUrlExtension(item.path, config.staticextension), _params); } else { string queryString = Regex.Replace(string.Format(item.path, _params), item.pattern, item.querystring, RegexOptions.None | RegexOptions.IgnoreCase); if (queryString.Length > 0) { queryString = "?" + queryString; } return linkStartString + model.page + queryString; } } } return string.Empty; }
2、DTcms.Webapipaymentalanceindex.aspx.cs中所有的linkurl方法改为例如
Response.Redirect(new Web.UI.BasePage().linkurlpay("payment", "?action=recharge")); //账户的余额不足
提交订单不打开新页面
templatesmobilepayment.html
<!--提交支付--> <form id="pay_form" name="pay_form" method="post" action="{config.webpath}api/payment/{payModel.api_path}/index.aspx" target="_blank">
去掉target="_blank"