Internet Explorer(11)返回不同的用户代理 [英] Internet Explorer (11) return different user agents

查看:94
本文介绍了Internet Explorer(11)返回不同的用户代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在实施一种支付系统,在该系统中,通过卡的详细信息被发布到网关页面,该页面将用户透明地重定向回我的站点. 我的会话会验证用户代理,以确保它们在每个请求中都相同. 在Chrome和FF上都可以正常工作,但是在IE中,透明重定向上的用户代理发送有所不同.

I am implementing a payment system where by the card details are posted to the gateway page which transparently redirect the user back to my site. My session verifies the User Agent to make sure they are the same in each request. This works fine in both Chrome and FF, however in IE, user agent send is different on the transparent redirect.

请求1. Ajax请求以设置支付数据.用户代理为 像Gecko一样的Mozilla/5.0(Windows NT 6.1; WOW64; Trident/7.0; rv:11.0)

Request 1. An Ajax request to setup the payment data. User Agent is Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko

请求2.透明重定向从网关返回. (获取请求)代理为 Mozilla/5.0(兼容; MSIE 10.0; Windows NT 6.2; Trident/6.0)

Request 2. Transparent redirect coming back from gatway. (GET Request) Agent is Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; Trident/6.0)

由于代理已更改,这基本上中断了我的会话,因为这被视为新会话. 我可以轻松关闭用户代理检查功能,但我想保留该功能. 知道发生了什么事吗?

Which basically breaks my session as it's taken as a new session now that the agent is changed. I can easily switch off user agent checking, but I'd like to keep that. Any idea what's going on?

推荐答案

我建议不要进行用户代理检查.在我自己的项目中,我们通常会生成一个令牌,将其存储在会话中并将其包含在重定向URL中.当用户回来时,您可以将其与会话中存储的内容进行比较.

I'd advise against the user-agent check. In my own projects we usually generate a token which we store in the session and include it in the redirect URL. When your user comes back you can compare that with what's stored in your session.

这篇关于Internet Explorer(11)返回不同的用户代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆