[RESOLVED] Monitor HTTP data sent and recieved over a webbrowser control
How can i monitor the HTTP data (headers including raw html data) that is sent and recieved while a user browses with a web browser control in my application?
is there some way to capture the connection itself into a socket?
thanks in advance,
imadthemad
Re: Monitor HTTP data sent and recieved over a webbrowser control
i couldn't find a way to do it...
i thought about putting a proxy for the webcontrol and capturing it with a tcplistener
but i couldnt find a way to put a proxy on the webcontrol
any help?
there must be a way, atleast to capture connections by my own application...
1 Attachment(s)
Re: Monitor HTTP data sent and recieved over a webbrowser control
Here's an example:
http://www.vbforums.com/showthread.p...ighlight=proxy
Check my attachment in post #15
By the way, this is how you setup IE to use the proxy:
Re: Monitor HTTP data sent and recieved over a webbrowser control
thanks but i have no problem making tcp listeners
i have a problem in that: a) i dont want a permanent proxy on my internet explorer
b) i really just want to monitor what is in the webcontrol. which brings me to the same problem:
how does one set the proxy of the web browser?
It's not like there is webbrowser1.proxy = "127.0.0.1:212"....
alternatively if i could intercept the data just like programs like httpanalyzer, httpbugger, and wireshark do, it would be awesome.
so, i ask again for help...
Re: Monitor HTTP data sent and recieved over a webbrowser control
Ups... I just noticed this is a .NET forum... I thought I was in the VB6 section :blush:
So your talking about a web control (ascx) that is included in a ASP.NET page (aspx) ?
If yes, then I'm not sure how to monitor ONLY the web control because the control becomes part of the aspx page.
Sorry I cannot help. At least now more people will look at this thread :D
Re: Monitor HTTP data sent and recieved over a webbrowser control
nope im working with VB 2008 application not asp.net page
i really am having trouble figuring this out. i thot some1 would have answered me by now :S
2 options i cant figure out either one:
1) can i set a proxy for a webbrowser control?
2) can i intercept network data sent\recieved by my program in any way?
Re: Monitor HTTP data sent and recieved over a webbrowser control
Quote:
Originally Posted by
CVMichael
Sorry I cannot help. At least now more people will look at this thread :D
hahaha :)
i think they are using the webbrowser on a windows form ( not asp ) have you tried the webbrowser's before navigate event? it usually allows you to inspect headers.
if you want to look at all data passing through a webbrowser, especially if you are trying to emulate something like wireshark, i think you'll find it may take some pretty heavy low level code using C++ & may be out of the scope of vb.net.
Re: Monitor HTTP data sent and recieved over a webbrowser control
fair enough on the emulation point
i thought there might be an inherent way to monitor network data of your own application in vb.net, i guess not...
but there has to be a way to set a proxy for a web browser!
im going to checkout before navigate now maybe there is something useful there...
Re: Monitor HTTP data sent and recieved over a webbrowser control
i couldnt even find a beforenavigate event
and the navigating event only shows URL
:sadface:
Re: Monitor HTTP data sent and recieved over a webbrowser control
you may want to import mshtml to use some events, i don't know if the newer .NET browser has those events exposed.
but here's a link to how to use a proxy in a webbrowser in .net ... http://*************.com/index.php?/...owser-control/
and here's a link explaining some of the before navigate thing... http://msdn.microsoft.com/en-us/library/aa752044%28v=vs.85%29.aspx
edited: link wont show up http://v b d o t n e t forum.com/index.php?/topic/503-use-proxy-with-web-browser-control/ (without the spaces)
Re: Monitor HTTP data sent and recieved over a webbrowser control
nvm
here is the charming solution
vb Code:
<Runtime.InteropServices.DllImport("wininet.dll", SetLastError:=True)> _ Private Shared Function InternetSetOption(ByVal hInternet As IntPtr, ByVal dwOption As Integer, ByVal lpBuffer As IntPtr, ByVal lpdwBufferLength As Integer) As Boolean
End Function
Public Structure Struct_INTERNET_PROXY_INFO
Public dwAccessType As Integer
Public proxy As IntPtr
Public proxyBypass As IntPtr
End Structure
Private Sub RefreshIESettings(ByVal strProxy As String)
Const INTERNET_OPTION_PROXY As Integer = 38
Const INTERNET_OPEN_TYPE_PROXY As Integer = 3
Dim struct_IPI As Struct_INTERNET_PROXY_INFO
' Filling in structure
struct_IPI.dwAccessType = INTERNET_OPEN_TYPE_PROXY
struct_IPI.proxy = Marshal.StringToHGlobalAnsi(strProxy)
struct_IPI.proxyBypass = Marshal.StringToHGlobalAnsi("local")
' Allocating memory
Dim intptrStruct As IntPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(struct_IPI))
' Converting structure to IntPtr
Marshal.StructureToPtr(struct_IPI, intptrStruct, True)
Dim iReturn As Boolean = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_PROXY, intptrStruct, System.Runtime.InteropServices.Marshal.SizeOf(struct_IPI))
End Sub
Re: [RESOLVED] Monitor HTTP data sent and recieved over a webbrowser control
you're welcome :rolleyes: