Results 1 to 12 of 12

Thread: [RESOLVED] Monitor HTTP data sent and recieved over a webbrowser control

  1. #1

    Thread Starter
    Hyperactive Member imadthemad's Avatar
    Join Date
    May 2005
    Posts
    344

    Resolved [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
    Basketball-NBA Dream status - quit
    Programming-Next Bill Gates Dream status - quit
    Becoming a doctor dream - LIVING IT: Med 2\4

  2. #2

    Thread Starter
    Hyperactive Member imadthemad's Avatar
    Join Date
    May 2005
    Posts
    344

    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...
    Basketball-NBA Dream status - quit
    Programming-Next Bill Gates Dream status - quit
    Becoming a doctor dream - LIVING IT: Med 2\4

  3. #3
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    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:
    Attached Images Attached Images  
    Last edited by CVMichael; Jan 25th, 2011 at 03:18 PM.

  4. #4

    Thread Starter
    Hyperactive Member imadthemad's Avatar
    Join Date
    May 2005
    Posts
    344

    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...
    Basketball-NBA Dream status - quit
    Programming-Next Bill Gates Dream status - quit
    Becoming a doctor dream - LIVING IT: Med 2\4

  5. #5
    PowerPoster
    Join Date
    Feb 2002
    Location
    Canada, Toronto
    Posts
    5,803

    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

    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

  6. #6

    Thread Starter
    Hyperactive Member imadthemad's Avatar
    Join Date
    May 2005
    Posts
    344

    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?
    Basketball-NBA Dream status - quit
    Programming-Next Bill Gates Dream status - quit
    Becoming a doctor dream - LIVING IT: Med 2\4

  7. #7
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142

    Re: Monitor HTTP data sent and recieved over a webbrowser control

    Quote Originally Posted by CVMichael View Post
    Sorry I cannot help. At least now more people will look at this thread
    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.
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  8. #8

    Thread Starter
    Hyperactive Member imadthemad's Avatar
    Join Date
    May 2005
    Posts
    344

    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...
    Basketball-NBA Dream status - quit
    Programming-Next Bill Gates Dream status - quit
    Becoming a doctor dream - LIVING IT: Med 2\4

  9. #9

    Thread Starter
    Hyperactive Member imadthemad's Avatar
    Join Date
    May 2005
    Posts
    344

    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:
    Basketball-NBA Dream status - quit
    Programming-Next Bill Gates Dream status - quit
    Becoming a doctor dream - LIVING IT: Med 2\4

  10. #10
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142

    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)
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  11. #11

    Thread Starter
    Hyperactive Member imadthemad's Avatar
    Join Date
    May 2005
    Posts
    344

    Re: Monitor HTTP data sent and recieved over a webbrowser control

    nvm
    here is the charming solution
    vb Code:
    1. <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
    2. End Function
    3. Public Structure Struct_INTERNET_PROXY_INFO
    4. Public dwAccessType As Integer
    5. Public proxy As IntPtr
    6. Public proxyBypass As IntPtr
    7. End Structure
    8. Private Sub RefreshIESettings(ByVal strProxy As String)
    9. Const INTERNET_OPTION_PROXY As Integer = 38
    10. Const INTERNET_OPEN_TYPE_PROXY As Integer = 3
    11. Dim struct_IPI As Struct_INTERNET_PROXY_INFO
    12. ' Filling in structure
    13. struct_IPI.dwAccessType = INTERNET_OPEN_TYPE_PROXY
    14. struct_IPI.proxy = Marshal.StringToHGlobalAnsi(strProxy)
    15. struct_IPI.proxyBypass = Marshal.StringToHGlobalAnsi("local")
    16. ' Allocating memory
    17. Dim intptrStruct As IntPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(struct_IPI))
    18. ' Converting structure to IntPtr
    19. Marshal.StructureToPtr(struct_IPI, intptrStruct, True)
    20. Dim iReturn As Boolean = InternetSetOption(IntPtr.Zero, INTERNET_OPTION_PROXY, intptrStruct, System.Runtime.InteropServices.Marshal.SizeOf(struct_IPI))
    21. End Sub
    Basketball-NBA Dream status - quit
    Programming-Next Bill Gates Dream status - quit
    Becoming a doctor dream - LIVING IT: Med 2\4

  12. #12
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142

    Re: [RESOLVED] Monitor HTTP data sent and recieved over a webbrowser control

    you're welcome
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width