Response.Redirect & window.location.href
对接中信的微信H5支付时,对方(其实是微信)需要对我们的域名进行授权,即,我方需向渠道报备支付域名,微信只认可由此域名发起的支付交易。
支付中心只提供了一套支付接口供下游系统访问。因为给渠道报备的域名是支付中心的域名,为此,支付中心需要做一个中间页,由这个中间页发起到渠道的支付请求。
protected void Page_Load(object sender, EventArgs e)
{
LogHelper.Write("h5请求url:" + Request.Url.ToString());
if ("" != Request.QueryString["mweb_url"])
{
Response.Redirect(Request.QueryString["mweb_url"]);
}
else
{
Response.Write("ok");
Response.Write(Request.Url.ToString());
}
}
测试时,发现微信仍然提示域名不一致。
于是,修改代码,废掉Response.Redirect,改用js的window.location.href来实现浏览器重定向跳转。再次发起支付,发现果然ok!
通过demo测试,使用Response.Redirect做页面跳转时,无法获取到上次请求的url信息,而通过window.location.href是可以的。这也证明了为什么微信校验请求域名失败。

Response.Redirect & window.location.href的更多相关文章
- response.redirect 与location.href 的区别
最近做项目时发现,先弹出提示框,再跳转页面 这样写:Jscript.Alert("你好,Hello!"); Response.Redirect("/index.aspx& ...
- window.location.href的用法
在写ASP.Net程序的时候,我们经常遇到跳转页面的问题,我们经常使用Response.Redirect 做ASP.NET框架页跳转,如果客户要在跳转的时候使用提示,这个就不灵光了,如: Respon ...
- window.location.href的使用方法
http://hljqfl.blog.163.com/blog/static/40931580201122210573364/ 在写ASP.Net程序的时候,我们常常遇到跳转页面的问题,我们常常使用R ...
- [转载]window.location.href的用法(动态输出跳转)
无论在静态页面还是动态输出页面中window.location.href都是不错的用了跳转的实现方案 javascript中的location.href有很多种用法,主要如下. self.loca ...
- window.location.href详解
在写web程序的时候,我们经常遇到跳转页面的问题,我们经常使用Response.Redirect做页面跳转,如果客户要在跳转的时候使用提示,这个就不灵光了,如: Response.Write(&quo ...
- 超链接导致window.location.href失效的解决办法
通常我们采用 window.location.href 执行页面间的跳转,比如下面的语句 window.location.href = 'https://www.baidu.com/'; 一般执行上面 ...
- window.top.location.href 和 window.location.href 的区别
"window.location.href"."location.href"是本页面跳转. "parent.location.href" 是 ...
- 关于js中window.location.href,location.href,parent.location.href,top.location.href的用法
"window.location.href"."location.href"是本页面跳转 "parent.location.href"是上一 ...
- window.location.href 中文乱码问题。。。。
window.location.href 中文乱码问题.... 要解决此问题需要两次解码, 第一次解码: 是在页面中的js脚本中解码:window.location.href = "save ...
随机推荐
- HDU 5950 - Recursive sequence - [矩阵快速幂加速递推][2016ACM/ICPC亚洲区沈阳站 Problem C]
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5950 Farmer John likes to play mathematics games with ...
- 1.7Oob 方法体中的循环也能也能返回值给方法
public String monthString(int monthNumber){ switch(monthNumber){ case 1: return "january"; ...
- 挖矿程序的工作原理(BTC为例)
Mining时代进化:CPU挖矿 -> GPU挖矿 -> FPGA挖矿 -> ASIC挖矿CPU挖矿时代:SENGENERATEGPU挖矿时代:GETWORK Miner:挖矿的程序 ...
- flex-shrink (适用于弹性盒模型容器子元素)
设置或检索弹性盒的收缩比率(根据弹性盒子元素所设置的收缩因子作为比率来收缩空间.) 语法 flex-shrink: <number> (default 1) flex-shrink的默认值 ...
- Sethi model
小结: 1. 销量 广告 微分方程 动态系统 市场份额 https://en.wikipedia.org/wiki/Sethi_model The Sethi model was developed ...
- Mac终端的Cocoapods的安装及使用
阅读目录 第一步,首先要检查Mac是否安装了rvm.打开终端,输入指令 rvm -v 第二步,用rvm安装ruby环境 第三步,检查更新RubyGems(Ruby1.9.1 以后的版本自带RubyGe ...
- ORA-01950: no privileges on tablespace XXX
原因是该表空间没有为用户提供配额空间 alter user WANGGUAN quota unlimited on TS_ACCT_DAT_01; 在表空间中为该用户设置磁盘配额即可
- selenium如何定位同级节点
场景:当定位某个元素时,发现所需要的元素在同级节点,可以用/following-sibling::* 方法(定位同级的第二位) 当定位统计节点的第二个定位相邻节点. 可以用/preceding ...
- 【Python爬虫】Requests库的基本使用
Requests库的基本使用 阅读目录 基本的GET请求 带参数的GET请求 解析Json 获取二进制数据 添加headers 基本的POST请求 response属性 文件上传 获取cookie 会 ...
- 用uart实现printf函数
硬件:JZ2440 实现功能:用putchr()函数实现printf() start.s nand.c uart.c uart.h my_stdio.c my_stdio.h main.c start ...