Hello everyone,
I am using VSTS 2008 + C# + .Net 3.5 to develop ASP.Net. I want to dump all response headers returned to client for a specific aspx file. Any ideas how to do this easily?
I know how to use Response.Headers collection, but my confusion is where to enumerate to get the accurate response header? For example, if I enumerate in Page_Load, not all response headers could be enumerated, but if I enumerate after Response.Close, exception will be thrown.
Any advice?
EDIT1: Meeting with the following exception when using OnPreRender in VSTS 2008 debug mode (i.e. pressing F5 to debug)
{"This operation requires IIS integrated pipeline mode."}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
using (StreamWriter writer = new StreamWriter("dump123.txt", true))
{
writer.WriteLine(DateTime.UtcNow + " Response headers");
foreach (string item in HttpContext.Current.Response.Headers.Keys)
{
writer.WriteLine(item + " : " + HttpContext.Current.Response.Headers[item]);
}
}
}
thanks in advance, George