Capturing all HTTP traffic between browser and server in .NET

  • Thread starter Thread starter gomisha
  • Start date Start date
G

gomisha

I have a .NET (C#) web browser control wrapper that automates the
browser for testing purposes. I'd like to add the ability of reading
all HTTP traffic between the browser control and a web server and I'd
like to do it in C#, through the web browser control.
From readings that I've done, it looks like the Asynchronous Pluggable
Protocols (APP) is the way to do this although all the code samples are
in C++. I've tried importing URLMON.DLL into .NET (through aximp and
tlbimp) with no luck.

1) Is there a way to implement APP in .NET?

2) Is there another way, besides APP, that can be used for .NET web
browser control implementations (e.g. classes from System.Net and
System.Net.Sockets)?

Thanks in advance.

-- Misha Rybalov
www.abcwebtest.com
www.autotestguy.com
 
gomisha said:
1) Is there a way to implement APP in .NET?

I believe it is not possible. URLMon has this nasty habit of calling
APP's methods on worker threads in blatant violation of COM threading
rules. .NET framework throws a fit when called on a wrong thread like
this. See

http://groups.google.com/group/micr...rowser_ctl/browse_frm/thread/57d6e3492094c051
2) Is there another way, besides APP, that can be used for .NET web
browser control implementations (e.g. classes from System.Net and
System.Net.Sockets)?

Realize that WebBrowser control is a native ActiveX control, hosted in
..NET via COM interop. It itself does not use any managed facilities for
its network communication needs. I strongly doubt you can do anything to
it in .NET.

Does the interception have to be in the same application? There are
quite a few packet sniffers available (see e.g.
http://www.ethereal.com ) for monitoring network traffic?
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925
 
gomisha said:
I have a .NET (C#) web browser control wrapper that automates the
browser for testing purposes. I'd like to add the ability of reading
all HTTP traffic between the browser control and a web server and I'd
like to do it in C#, through the web browser control.

Protocols (APP) is the way to do this although all the code samples are
in C++. I've tried importing URLMON.DLL into .NET (through aximp and
tlbimp) with no luck.

1) Is there a way to implement APP in .NET?

2) Is there another way, besides APP, that can be used for .NET web
browser control implementations (e.g. classes from System.Net and
System.Net.Sockets)?

Thanks in advance.

-- Misha Rybalov
www.abcwebtest.com
www.autotestguy.com
You could do that using TCP proxy. Find an open-source proxy for .Net
and modify it.
 
Back
Top