Thursday, March 24, 2011

Is it possible to track every http/url redirects using .NET?

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?

From stackoverflow
  • 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.

  • 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.

    Christian Nunciato : 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!
    Leon Tayson : Not using a WebBrowser control & I'm trying to monitor any browser the user may be running. I've used fiddler and it would be great if I can implement listening to http redirects from my windows forms app. Imagine this app as a service app which listens to url/http requests

0 comments:

Post a Comment