拦截WebBrowser在C#中发出的请求 [英] Intercepting requests made by WebBrowser in C#

查看:765
本文介绍了拦截WebBrowser在C#中发出的请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以拦截 WebBrowser 控件发出的所有请求?

Is it possible to intercept all requests made by a WebBrowser control?

我想修改请求每个请求的URI(包括对图像,脚本,样式表等的请求)

I want to modify the request URI of every single request (including requests for images, scripts, stylesheets, etc.)

推荐答案

有一个名为< a href =http://msdn.microsoft.com/en-us/library/aa768326(VS.85).aspx\"rel =nofollow noreferrer> BeforeNavigate2 在发出任何请求之前调用。您可以使用它来修改传出请求。

There is an event called "BeforeNavigate2" that is called before any request is made. You can use this to modify the outgoing requests.

这篇关于拦截WebBrowser在C#中发出的请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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