I am tracing my ASPX page by enabling tracing in web.config
(<trace enabled="true" pageOutput="true"/>
)
How could i save this information (specifically the request headers) into a log file.
Thanks for sharing your valuable time.
Simply enabling tracing the way your have is not enough - you need to configure what to trace and what to do with the trace.
See Trace Listeners and Configuring Tracing on MSDN.
Check the below link which show various options of tracing
http://www.codeproject.com/Articles/82290/Step-by-Step-Guide-to-Trace-the-ASP-NET-Applicatio
foreach (string key in HttpContext.Current.Request.Headers)
{
YourLoggingMethod(key, HttpContext.Current.Request.Headers[key]);
}
来源:https://stackoverflow.com/questions/10141723/how-to-save-trace-info-into-a-file