System.Net.HttpWebResponse.GetResponseHeader C# (CSharp) Method

GetResponseHeader() public method

public GetResponseHeader ( string headerName ) : string
headerName string
return string
        public string GetResponseHeader(string headerName)
        {
            CheckDisposed();
            string headerValue = Headers[headerName];
            return ((headerValue == null) ? String.Empty : headerValue);
        }

Usage Example

Example #1
0
 internal Response(HttpWebResponse response)
 {
     using (response)
     {
         using (Stream response_stream = response.GetResponseStream())
         {
             if (response_stream.CanRead)
             {
                 byte[] buffer = new byte[16654];
                 int read;
                 using (MemoryStream s = new MemoryStream())
                 {
                     while((read = response_stream.Read(buffer, 0, buffer.Length)) > 0)
                     {
                         s.Write(buffer, 0, read);
                     }
                     Body = new byte[s.Length];
                     s.Seek(0, SeekOrigin.Begin);
                     s.Read(Body, 0, Body.Length);
                 }
             }
         }
         Status = response.StatusCode;
         ContentType = response.GetResponseHeader("Content-Type");
         ETag = response.GetResponseHeader("ETag");
     }
 }
All Usage Examples Of System.Net.HttpWebResponse::GetResponseHeader