Skip to Main Content
C# in a Nutshell, Second Edition
book

C# in a Nutshell, Second Edition

by Peter Drayton, Ben Albahari, Ted Neward
August 2003
Intermediate to advanced content levelIntermediate to advanced
928 pages
32h 1m
English
O'Reilly Media, Inc.
Content preview from C# in a Nutshell, Second Edition

Name

WebResponse

Synopsis

This class represents a response received from a WebRequest. A response consists of headers (stored as key/value pairs in the Headers property) and a response body. You can obtain the response body as a System.IO.Stream using the GetResponseStream( ) method.

When you are finished with the response, call its Close( ) method; this releases any open resources still held by the WebResponse without having to wait for garbage collection to do so (which could take longer than desired).

public abstract class WebResponse : MarshalByRefObject, System.Runtime.Serialization.ISerializable, 
     IDisposable {
// Protected Constructors
   protected WebResponse( );
   protected WebResponse(System.Runtime.Serialization.SerializationInfo serializationInfo,
       System.Runtime.Serialization.StreamingContext streamingContext);
// Public Instance Properties
   public virtual long ContentLength{set; get; }
   public virtual string ContentType{set; get; }
   public virtual WebHeaderCollection Headers{get; }
   public virtual Uri ResponseUri{get; }
// Public Instance Methods
   public virtual void Close( );
   public virtual Stream GetResponseStream( );
}

Hierarchy

System.Object System.MarshalByRefObject WebResponse(System.Runtime.Serialization.ISerializable, System.IDisposable)

Subclasses

FileWebResponse, HttpWebResponse

Returned By

WebException.Response, WebRequest.{EndGetResponse( ), GetResponse( )}

Passed To

WebException.WebException( )

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C# in a Nutshell

C# in a Nutshell

Ben Albahari, Ted Neward, Peter Drayton
C# 7.0 in a Nutshell

C# 7.0 in a Nutshell

Joseph Albahari, Ben Albahari
C# Cookbook, 2nd Edition

C# Cookbook, 2nd Edition

Jay Hilyard, Stephen Teilhet
C# Cookbook

C# Cookbook

Stephen Teilhet, Jay Hilyard

Publisher Resources

ISBN: 0596005261Catalog PageErrata