views:

241

answers:

2

I'm doing a windows forms application and it requires me to log every url redirect that's happening on the user's machine. Like when a user googles something and he clicked on a sponsored link, there will be a number of redirects that'll happen there and i would like to track those redirects.

Is there any listener class that I can use to accomplish this?

A: 

I think you mean referrer, not redirect. If that's the case, in global.asax, in the application_begin method, log httpcontext.current.request.referrer.uri.

Shawn Simon
+3  A: 

If you're trying to monitor any browser the user may be running, implement a pass-through HTTP proxy and monitor the requests. The browser itself will still need to be configured to go through the proxy, and this process itself is browser-dependent.

While it is fairly straightforward, even a pass-through proxy is a nontrivial task, so you may want to base it on some third-party code such as Mentalis.org Proxy.

See Fiddler for an example of a tool that does this for debugging purposes.

Jeffrey Hantin
Nice -- I'd heard of Fiddler, but hadn't yet tried it out. Looks like it should solve the poster's question, too, since it can be incorporated into a .NET project. Thanks for the tip!
Christian Nunciato
Leon Tayson