在 C# 中拦截 WebBrowser 发出的请求
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/811587/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Intercepting requests made by WebBrowser in C#
提问by anonymous coward
Is it possible to intercept all requests made by a WebBrowser
control?
是否可以拦截WebBrowser
控件发出的所有请求?
I want to modify the request URI of every single request (including requests for images, scripts, stylesheets, etc.)
我想修改每个请求的请求 URI(包括对图像、脚本、样式表等的请求)
回答by David
There is an event called "BeforeNavigate2" that is called before any request is made. You can use this to modify the outgoing requests.
有一个名为“ BeforeNavigate2”的事件,它在发出任何请求之前被调用。您可以使用它来修改传出的请求。