对接中信的微信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的更多相关文章

  1. response.redirect 与location.href 的区别

    最近做项目时发现,先弹出提示框,再跳转页面 这样写:Jscript.Alert("你好,Hello!"); Response.Redirect("/index.aspx& ...

  2. window.location.href的用法

    在写ASP.Net程序的时候,我们经常遇到跳转页面的问题,我们经常使用Response.Redirect 做ASP.NET框架页跳转,如果客户要在跳转的时候使用提示,这个就不灵光了,如: Respon ...

  3. window.location.href的使用方法

    http://hljqfl.blog.163.com/blog/static/40931580201122210573364/ 在写ASP.Net程序的时候,我们常常遇到跳转页面的问题,我们常常使用R ...

  4. [转载]window.location.href的用法(动态输出跳转)

    无论在静态页面还是动态输出页面中window.location.href都是不错的用了跳转的实现方案   javascript中的location.href有很多种用法,主要如下. self.loca ...

  5. window.location.href详解

    在写web程序的时候,我们经常遇到跳转页面的问题,我们经常使用Response.Redirect做页面跳转,如果客户要在跳转的时候使用提示,这个就不灵光了,如: Response.Write(&quo ...

  6. 超链接导致window.location.href失效的解决办法

    通常我们采用 window.location.href 执行页面间的跳转,比如下面的语句 window.location.href = 'https://www.baidu.com/'; 一般执行上面 ...

  7. window.top.location.href 和 window.location.href 的区别

    "window.location.href"."location.href"是本页面跳转. "parent.location.href" 是 ...

  8. 关于js中window.location.href,location.href,parent.location.href,top.location.href的用法

    "window.location.href"."location.href"是本页面跳转 "parent.location.href"是上一 ...

  9. window.location.href 中文乱码问题。。。。

    window.location.href 中文乱码问题.... 要解决此问题需要两次解码, 第一次解码: 是在页面中的js脚本中解码:window.location.href = "save ...

随机推荐

  1. [No0000EC]C# 字符串(String)

    在 C# 中,可以使用字符数组来表示字符串,但是,更常见的做法是使用 string 关键字来声明一个字符串变量.string 关键字是 System.String 类的别名. 创建 String 对象 ...

  2. [No0000CD]shell 中的单行注释和多行注释

    1. 单行注释 众所周知,#  比如想要注释:echo “ni” # echo "ni" 2. 多行注释 法一: : << ! 语句1 语句2 语句3 语句4 ! 例如 ...

  3. hive优化之参数调优

    1.hive参数优化之默认启用本地模式 启动hive本地模式参数,一般建议将其设置为true,即时刻启用: hive (chavin)> set hive.exec.mode.local.aut ...

  4. nethogs 查看 Linux 进程的网络使用

    有时候我们客户会发现服务器或 VPS 网络慢,进一步发现大量带宽被占用,一些客户到这里为止就不知道怎么办了.有什么简单办法能找出哪个程序(或者进程)占用了带宽呢?Linux 监控流量的小工具不少,如 ...

  5. Shell实现判断进程是否存在并重新启动脚本

    Shell实现判断进程是否存在并重新启动脚本 - superbfly的专栏 - CSDN博客 https://blog.csdn.net/superbfly/article/details/52513 ...

  6. create table test_create_table_CreateAs as select * from test_create_table; 表结构的破坏 复制字段结构 复制表结构 LIKE

    案例中: 索引丢失.分区丢失 实际测试 Target Server Type : MYSQLTarget Server Version : 50616File Encoding : 65001 Dat ...

  7. A Method for the Construction of Minimum-Redundancy Codes

    A Method for the Construction of Minimum-Redundancy Codes http://compression.ru/download/articles/hu ...

  8. [development][c++] C++构造函数调用构造函数

    构造函数调用构造函数是会问题的. 外层函数返回的内存, 与被调用的构造函数返回的内存并不是一个内存. 错误示例代码如下: msg_log(const char *name, const char* t ...

  9. [knowledge][dpdk] open data plane

    https://www.opendataplane.org/ https://en.wikipedia.org/wiki/OpenDataPlane odp vs dpdk:  http://dpdk ...

  10. vue中watch的详细用法

    在vue中,使用watch来响应数据的变化.watch的用法大致有三种.下面代码是watch的一种简单的用法: <input type="text" v-model=&quo ...