WP7 和 Http-Referer
我编写了一个应用程序,可以显示来自 Disqus 的评论,当我在桌面上将其作为 .NET 应用程序运行时,它运行得很好。它发送一个 http 请求,然后反序列化 json 对象。但是,当我将代码移至 Windows Phone 应用程序时,我收到来自 Disqus 的错误。
看起来由于 Windows Phone 决定添加随机 http 引用,我的请求失败了。我不允许在 Windows Phone 上更改引用地址,如果我尝试这样做,我会收到消息“无法直接修改‘Referer’标头。”。
是否有解决方法,不需要我构建删除引用标头的代理?
I've written an app that shows comments from Disqus and when I run it as a .NET application on my desktop it works great. It sends a http requst and then deserialize the json objects. But when I move the code to my Windows Phone app I get an error from Disqus.
It appears that because Windows Phone decides to add a random http referer my request fails. I'm not allowed to change the referer on the windows phone I get the message "The 'Referer' header cannot be modified directly." if I try to do that.
Is there a workaround for this that doesn't require me to build a proxy that removes the referer header?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我从这篇文章收集到的信息,没有无需使用代理服务即可删除
Referer header
的方法。显然这段代码对一个人有效:但是,似乎该线程中的普遍共识是无法更改它,但应该在
Mango
版本中修复它。From what I can gather from this post, there's no way to remove the
Referer header
without using a proxy service. Apparently this code worked for one person:However, it seems that the general consensus in that thread is that there's no way to change it, but it should be fixed in the
Mango
version.使用
request.Headers[HttpRequestHeader.Referer] =referer
而不是 request.Referer = Referer ,它会起作用Instead of
request.Referer = referer
userequest.Headers[HttpRequestHeader.Referer] = referer
and it will work