IrfanRaza
IrfanRaza

Reputation: 3058

How to save trace info into a file

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.

Upvotes: 3

Views: 8128

Answers (3)

Joe
Joe

Reputation: 1669

foreach (string key in HttpContext.Current.Request.Headers)
 {
     YourLoggingMethod(key, HttpContext.Current.Request.Headers[key]);
 }

Upvotes: -2

Oded
Oded

Reputation: 498914

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.

Upvotes: 6

Ravi Vanapalli
Ravi Vanapalli

Reputation: 9942

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

Upvotes: 3

Related Questions