使用WebBrowserControl Capture Form Post [英] Use WebBrowserControl Capture Form Post

查看:159
本文介绍了使用WebBrowserControl Capture Form Post的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为专门的系统开发Html / Http检查UI。我想知道是否有人知道如何捕获从代码中生成的WebBrowserControl内部的POST的值,以捕获发布的值和帖子的位置(操作)。我不是在寻找一个工具,因为Fiddler和Firebug的Net面板都做得很好,我正在寻找一种方法来使用WebBrowserControl从.Net捕获和记录代码中的帖子。有没有办法做到这一点?

I am working on an Html/Http inspection UI for a specialized system. I am wondering if someone knows how to capture the values of a POST generated inside of a WebBrowserControl from code to trap what values were posted and the location(action) of the post. I am not looking for a tool as Fiddler and Firebug's Net panel both do this beautifully, I am looking for a way to capture and record posts in code from .Net using the WebBrowserControl. Is there a way to do this?

注意:我这个工具的当前版本读取并检查HTMLDocument上的表单/值,但这是不够的,因为经常形式可以通过脚本动态提交并更改动作/表单值,或者提交给不同的隐藏或动态创建的表单。

Note: My current version of this tool reads and inspects forms/values present on the HTMLDocument, but it is not sufficient since often forms can be dynamically submitted via script and have the action/form values altered, or submit to a different hidden or dynamically created form.

我愿意进行正在进行的http检查库/代码/代理到位,如果这是唯一的方法。任何建议都将不胜感激。

I am open to having an in process http inspection library/code/proxy in place if that is the only way to do this. Any suggestions would be greatly appreciated.

推荐答案

好的。这篇文章 http:// social.msdn.microsoft.com/forums/en-US/winforms/thread/eab43afa-df4d-4278-926a-b07d2d6ca9fd/ 引导我对 codeproject here ,它包装WebBrowserControl并公开扩展的DWebBrowserEvents2事件数据,其中包含postData和header pre-navigation,以便你可以抓住它们。我确实需要扩展该示例的BrowserExtendedNavigatingEventArgs实现来处理postData和header,但这很简单。

OK. This post http://social.msdn.microsoft.com/forums/en-US/winforms/thread/eab43afa-df4d-4278-926a-b07d2d6ca9fd/ led me to an extended implementation of the WebBrowser control on codeproject here which wraps the WebBrowserControl and exposes the extended DWebBrowserEvents2 event data which contains the postData and headers pre-navigation so that you can capture them. I did have to extend that example's implementation of BrowserExtendedNavigatingEventArgs to handle postData and headers but that was trivial.

希望这可以帮助其他人。

Hopefully this helps someone else out.

这篇关于使用WebBrowserControl Capture Form Post的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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