What is the best way to monitor http traffic that goes out of (and comes into) the PC Sniffing packets using raw sockets doesnt seem to serve the purpose since I'm more interested in the http data part (if I sniff each tcp packet, it looks like I need to aggregate them and try to figure out where the data is).
I came across this tool "http analyzer std" ( http://www.ieinspector.com/httpanalyzer/ ) which gives the complete http along with the process that sent/received this traffic. I'd like to know if this can be done using c#.

Monitoring http using c#
erdoll
Binu Jeesman
Hi
There is no such utility avalible or atleast I don't know about any, but as I have done this you have to snif all the trafic and then you have to filter that accordingly, there will be Header, Contents, cockies, Query Strings and so on in that data you have to filter all these to extract the right data.
nhaas
Thanks for the reply. My question was not about writing a sniffer but how to read http data and aggregate it. I've created sniffers in the past, so thats not the issue.
Thanks
Karthik
Jassim Rahma
The next best thing to have would be something like a proxy server. When my app runs, I need to be able to configure IE / Firefox to use my app as proxy, and then change back the settings when the app closes down. Any idea how to do this programmatically
Sanjukta
if i undersatnd your requierment correctly i think you need HttpProxy to inspect http headers,debug http etc
if this what you want
you can take a look at Fiddler http debug proxy it is from microsoft it is free but not open source you can find it at https://www.fiddlertool.com/fiddler/
and there is an article Fiddler PowerToy - Part 1: HTTP Debugging
another proxy but this time it is open source that you can use it as start is Proxy from http://www.mentalis.org/ you can download it at http://www.mentalis.org/soft/projects/proxy/
and of course as you know .Net 2 have HttpListner class that alow you to build your http server,proxy HttpListener Class (System.Net)
i hope this help
venp
to 127.0.0.1:8888, so that IE sends all its traffic to fiddler. It doesnt monitor the traffic from other browsers, or from instant messengers (including MSN), unlike HTTP Analyzer. Thats fine, I just wanted to get an idea how this thing is done.
Thanks for pointing me to the httplistener class. I'll take a look at it.
Derek at Potters Clay
I have not ever created a sniffer myself but here's how it's done.
You have to insert into the network via a socket in a mode called Promicuous mode. This allows you to see all packets the flow across the wire. If you don't insert promicusouly, you can only see the packets destined for your IP addr.
But if it is really packet sniffing that you want to do, why not try using Ethereal It's free and super easy to use. You can set up the capture filter to only capture information you are interested in. It is very, very powerful.