Robert Morgan
Robert Morgan

Reputation: 665

Capturing HTTP requests

Is there a way to monitor and capture all outgoing HTTP requests from a machine using C#?

I need a browser independent way of logging visited URLs.

Upvotes: 5

Views: 26609

Answers (6)

Ahmed Atia
Ahmed Atia

Reputation: 17960

I hope if Wirehark works for you. It's free and cross-platform. Also, "Wireshark is the world's foremost network protocol analyzer, and is the de facto (and often de jure) standard across many industries and educational institutions"

Have look, Wireshark-Wikipedia

Upvotes: 2

Vasil
Vasil

Reputation: 38106

Also, writing a simple http proxy for this purpose in C# is a trivial task.

Upvotes: -3

CraigTP
CraigTP

Reputation: 44909

Sounds like you're after some kind of "packet sniffing" utility.

Here's a couple of links to articles on the Code Project site for packet sniffers (with downloadable source code) written in C#:

Packet Capture and Analayzer

A Network Sniffer in C#

If you're just after capturing visited URL's, these utilities may be overkill, however, you'll be able to extract a URL from your HTTP packets and discard the rest, however, you may also wish to capture all packet information, in which case, these utilities will help.

Upvotes: 5

WiseTechi
WiseTechi

Reputation: 3598

You may want to use existing network interfaces capturing libraries like pcap or winpcap to do so. Rewriting all the necessary stuff by yourself would be quite time expensive.

Link to Pcap

Link to WinPcap

Edit : Just saw someone also wrote the C# bindings to winpcap : SharpPcap

Upvotes: 9

ZombieSheep
ZombieSheep

Reputation: 29953

You're probably going to save lots of time and effort with some kind of proxy setup. A decent local-machine solution would be Fiddler (requires Windows), or something like a Squid server for a networked solution.

Upvotes: 3

Rob
Rob

Reputation: 2110

I use fiddler ( http://www.fiddler2.com )

Upvotes: 11

Related Questions