简体   繁体   English

将HTTP标头附加到所有IE请求

[英]Append an HTTP header to all IE requests

I have a scenario which requires me to append an HTTP header to all outgoing IE-based HTTP communications on a machine. 我有一种情况,要求我将HTTP标头附加到计算机上所有基于IE的传出HTTP通信中。 This doesn't need to work outside of IE. 不需要在IE之外工作。

I first attempted to create a simple HTTP proxy in C#, but the performance of this proxy wasn't very good, and there were issues with HTTPS communications. 我首先尝试用C#创建一个简单的HTTP代理,但是此代理的性能不是很好,并且HTTPS通信存在问题。

My second attempt was to use FiddlerCore, which I hoped would have better performance, but was only marginally faster than what I had created myself. 我的第二次尝试是使用FiddlerCore,我希望它能有更好的性能,但仅比我自己创建的速度快一点。

Aside from writing a TCP filter driver to do this (not in my skillset), is there another option? 除了编写一个TCP筛选器驱动程序来做到这一点(不在我的技能范围内),还有其他选择吗? Strictly speaking, this doesn't have to be an HTTP header. 严格来说,这不必是HTTP标头。 It could even be something I tack on to the user agent string. 甚至可能是我在用户代理字符串上添加的内容。

I was thinking perhaps about creating a simple BHO, but I'm hoping there is an easier solution... one that I can write in C# perhaps. 我可能正在考虑创建一个简单的BHO,但我希望有一个更简单的解决方案……也许我可以用C#编写。

仅读取代码中的用户代理字符串,如果是IE,然后附加HTTP标头,该怎么办?

Just use user agent string. 只需使用用户代理字符串即可。 It is documented here http://msdn.microsoft.com/en-us/library/ms537503(VS.85).aspx . http://msdn.microsoft.com/zh-cn/library/ms537503(VS.85).aspx中进行了记录

Per article following registry key can be used to add to the user agent string: SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\User Agent\\Pre Platform\\Token = Value . 每篇文章下面的注册表项都可以用于添加到用户代理字符串: SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\User Agent\\Pre Platform\\Token = Value

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM