"_jpg_" <de************ *************** **@xoxy.net> wrote in message
news:uy******** ******@tk2msftn gp13.phx.gbl...
Ideally I would like all the headers, or be able to set whatever I need
to so that I can modify a response object to recreate whatever the
previous one would have.
I believe the technical term for this is "SOL". :-(
I have written an HttpModule which can capture the complete request and
response - except for the response headers! When I got to that point in the
code, I found that they literally do not exist as a collection, and do not
exist in any fashion until after the request is completely over. Instead,
ASP.NET produces its headers by calling methods on a class provided by the
hosting environment.
Now, there's your one hope. If your code has to work in the completely
general case, give up now and save yourself the trouble. But if you can run
your code under your own host (i.e., your own web server), then you can
produce a hack to make this happen. I managed to do this by hacking a
version of Microsoft's Cassini web server (a part of the Web Matrix project
at
http://asp.net/webmatrix/default.asp...ex=4&tabId=46). As it turns
out, this was a fairly nasty hack, involving the server setting something in
one of the server variables for the HttpModule to read to pass back to a
static method in the server - it was pretty gross.
Under no circumstances would I consider such a hack suitable for any
production purpose. For any such purpose, I'd say, "sorry, find another way
to do it". For instance, you might be better off writing a network sniffer
or a custom proxy server than to screw around with private fields which are
as likely as not to change in the next .n release, or even on a service pack
release. "private" really means, "none of your business".
Good Luck. You'll need it.
--
John Saunders
Internet Engineer
jo***********@s urfcontrol.com