-1

I'm trying to implement a simple web application that will sit between IIS and the application. I need to monitor the API activity to get the calls and outgoing messages. I've been trying to mess around with HTTPListener as directed here: http://msdn.microsoft.com/en-us/library/system.net.httplistener.aspx, but the request always come up as null. Probably I'm looking in the wrong place, but any help/experience in this area is greatly appreciated.

Thanks!

4
  • Are you looking for a web proxy?
    – M.Babcock
    Dec 29, 2011 at 15:30
  • In short...yes, but the pp needs to be transparent to the client
    – Raytrace
    Dec 29, 2011 at 16:08
  • If it has to run independent from IIS (such that Brijesh's answer below would not work), then the options are fairly limited in .NET and using the HttpListener will definitely not be transparent under any circumstance. You could however use something like SharpPcap (tamirgal.com/blog/page/SharpPcap.aspx) with the right filters and use that to monitor the network traffic.
    – M.Babcock
    Dec 29, 2011 at 16:12
  • I'm looking to implement it to manipulate the traffic requests and response. I know Fiddler does this job, and it uses SharpPcap library, but I need something to 1)Do some extra functions which I have developed, and 2)Sit in between IIS and the API without causing delays. I'll dig more into SharpPcap as you have hinted, but do you know of any simple examples out there for what I'm trying to implement? Thanks!
    – Raytrace
    Dec 29, 2011 at 16:20

1 Answer 1

0

you need to play with httpmodule and httphandler, and if you want it more generice look at ISAPI filters

5
  • Looks to me httpmodule might be of use to me as mentioned here: forums.asp.net/post/3416052.aspx, but anyone knows of a working example to implement statistics and/or loggging? Seems to be a simpler solution then messing around with a 3rd party library
    – Raytrace
    Dec 29, 2011 at 18:31
  • if you are in iis 7. have a look at appfabric. am not very sure if it will help Dec 29, 2011 at 18:43
  • Hmmm...just hit a brick wall. I had a quick look at appfabric, but it's not what I'm after. Furthermore, I don't have the source for the existing application I want to monitor to implement httpmodule. For reference if anyone wants a good example, MS has a great walkthrough here: msdn.microsoft.com/en-us/library/ms227673.aspx
    – Raytrace
    Dec 29, 2011 at 19:00
  • Implemented httpmodule and httphandler with success (sort of), but now the value returned to the client is what I am logging. Any way of having the value retained? ` public void ProcessRequest(HttpContext context) { context.Response.Write("The page request is " + context.Request.RawUrl.ToString()); StreamWriter sw = new StreamWriter(@"C:\requestLog.txt", true); sw.WriteLine("Page requested at " + DateTime.Now.ToString() + context.Request.RawUrl); sw.Close(); } public bool IsReusable { get return true; }`
    – Raytrace
    Jan 1, 2012 at 22:44
  • 1
    Answer found here: forums.asp.net/post/2417324.aspx. Thanks for your help @brijesh-mishra
    – Raytrace
    Jan 3, 2012 at 0:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.