HttpRequestTraceRecord.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / System.ServiceModel.Activation / System / ServiceModel / Activation / HttpRequestTraceRecord.cs / 1305376 / HttpRequestTraceRecord.cs

                            //------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------

namespace System.ServiceModel.Diagnostics 
{
    using System.Runtime.Diagnostics; 
    using System.Web; 
    using System.Xml;
 
    class HttpRequestTraceRecord : TraceRecord
    {
        HttpRequest request;
 
        internal HttpRequestTraceRecord(HttpRequest request)
        { 
            this.request = request; 
        }
 
        internal override string EventId { get { return BuildEventId("HttpRequest"); } }

        internal override void WriteTo(XmlWriter writer)
        { 
            writer.WriteStartElement("Headers");
            foreach (string key in this.request.Headers.Keys) 
            { 
                writer.WriteElementString(key, this.request.Headers[key]);
            } 
            writer.WriteEndElement();
            writer.WriteElementString("Path", this.request.Path);
            if (this.request.QueryString != null && this.request.QueryString.Count > 0)
            { 
                writer.WriteStartElement("QueryString");
                foreach (string key in this.request.QueryString.Keys) 
                { 
                    writer.WriteElementString(key, this.request.Headers[key]);
                } 
                writer.WriteEndElement();
            }
        }
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------

namespace System.ServiceModel.Diagnostics 
{
    using System.Runtime.Diagnostics; 
    using System.Web; 
    using System.Xml;
 
    class HttpRequestTraceRecord : TraceRecord
    {
        HttpRequest request;
 
        internal HttpRequestTraceRecord(HttpRequest request)
        { 
            this.request = request; 
        }
 
        internal override string EventId { get { return BuildEventId("HttpRequest"); } }

        internal override void WriteTo(XmlWriter writer)
        { 
            writer.WriteStartElement("Headers");
            foreach (string key in this.request.Headers.Keys) 
            { 
                writer.WriteElementString(key, this.request.Headers[key]);
            } 
            writer.WriteEndElement();
            writer.WriteElementString("Path", this.request.Path);
            if (this.request.QueryString != null && this.request.QueryString.Count > 0)
            { 
                writer.WriteStartElement("QueryString");
                foreach (string key in this.request.QueryString.Keys) 
                { 
                    writer.WriteElementString(key, this.request.Headers[key]);
                } 
                writer.WriteEndElement();
            }
        }
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK