Parsing a http response

  • Thread starter Thread starter nick.spacek
  • Start date Start date
N

nick.spacek

Hi everyone,
I'm using some packet sniffing code to grab HTTP packets, and I want to
turn the packets into a (preferably) HttpWebResponse. Is there any
way to do this, or am I going to have to write my own class to do this?

Thanks,
Nick
 
Nick,
an HttpWebResponse instance is normally created as the result of an
HttpWebRequest instance having it's Create method called, and then the
GetResponse method ,e.g.
HttpWebResponse webresponse = (HttpWebResponse)webrequest.GetResponse();

I'm just wondering why you would need to attempt to reconstruct all this out
from a packet sniffer when you can just make the request programatically?

Peter
 
The goal is to be intercepting incoming HTTP packets only and checking
their content against a filter. I probably haven't investigated well
enough yet - I'm not sure if it's possible for me to rewrite the
packets or just see what the contents are. The idea is that this will
be a system service that is sitting there watching.

Nick
 
OK then.
There is an article on codeproject.com with code to use C# to wrap WinPCap,
and apply filters. This may be helpful to you.
Peter
 
Back
Top