locked
Identifiying the source of a call to the proxy RRS feed

  • Question

  • Hi

    I have a WPF application with several web browser controls. a requirement that I have is to count the bytes on each web browser. in order to do that I created a proxy server and all of the trafic goes through that proxy, the problem is that I didn't find any way to identify which trafic came from which browser.

    Does anyone know how the proxy knows which IE to send the data to when opening more than one browser on on your computer (or more than one tab) and how I can duplicate this functionality in my code?

    Thank you

    Sunday, June 17, 2012 11:17 AM

All replies

  • A new client gets created for each webbrowser so the proxy (client) is a child process.  Yo can find the webbowser by getting the handle of the process and then going through the process list searcing for the parent.  The parent should be iexplore.exe.

    See if this example helps

    http://www.codeproject.com/Articles/9893/Get-Parent-Process-PID


    jdweng

    Sunday, June 17, 2012 12:50 PM
  • And how you distinguish instances of the browser? I suppose that they have different resources loaded at the moment of navigation. If yes, then you can inspect "Referer" header of the request. Other than this I doubt you can do anything in the proxy, as instances of WebBrowser won't send any system-specific identification to the server.

    Sincerely yours, Eugene Mayevski

    Sunday, June 17, 2012 4:12 PM
  • Joel:

    I checked before I posted this question, according to the task manager, when I open a webBrowser control in WPF (most likely in any GUI) it doesn't create a new process (according to the task manager), and if it does, how can I get that ID and how can I use it?

    Eugene:

    It might not be sending it to the server, but it does need to know where to send the responce from the server, that is the question.

    but thank you for trying

    Monday, June 18, 2012 4:56 AM
  • Normally I sort the task manage by User Name (or prcess name)to make it easier to see when a new process is added.  I always get a new iexplore.exe when a new webbrowser is opened.  sometimes I have 8 or 9 iexplore.exe running at the same time.

    jdweng

    Monday, June 18, 2012 9:02 AM
  • If you open IE than yes, but when I open the webBrowser control in a WPF application than it uses the process of the application and not a new one.

    and even if it does, how can I use the process ID in order to identify the connection, I don't have the process ID in the request/response from the proxy or the connection details

    Monday, June 18, 2012 10:51 AM
  • The control is on a form which is on a window with a handle number (process number).  the proxy code should contain a client where you can add code to locate the parent process.


    jdweng

    Monday, June 18, 2012 11:00 AM
  • Joel. From my reading there is a single program with multiple WebBrowser controls in it. Therefore there is only one process and thus no way to identify the different WB controls.

    http://www.alanjmcf.me.uk/ Please follow-up in the newsgroup. If I help, please vote and/or mark the question answered. Available for contract programming.

    Tuesday, June 19, 2012 8:49 PM
  • Do you control the destination web server as well? If so add a query parameter in the request each webbrowser control makes and then you can differentiate them based on that...


    http://www.alanjmcf.me.uk/ Please follow-up in the newsgroup. If I help, please vote and/or mark the question answered. Available for contract programming.

    Tuesday, June 19, 2012 8:50 PM
  • Alan: Webbrowser controls have unique handle properties so what I said is valid.

    jdweng

    Wednesday, June 20, 2012 1:31 AM