PART II
C h a p t e r 2 5 :
N e t w o r k i n g T h r o u g h t h e I n t e r n e t U s i n g S y s t e m . N e t
825
Method
Description
public static WebRequest Create(string
uri
)
Creates a
WebRequest
object for the URI
specified by the string passed by
uri.
The object
returned will implement the protocol specified by
the prefix of the URI. Thus, the object will be an
instance of a class that inherits
WebRequest
. A
NotSupportedException
is thrown if the requested
protocol is not available. A
UriFormatException
is
thrown if the URI format is invalid.
public static WebRequest Create(Uri
uri
)
Creates a
WebRequest
object for the URI specified
by
uri.
The object returned will implement the
protocol specified by the prefix of the URI. Thus,
the object will be an instance of a class that
inherits
WebRequest
. A
NotSupportedException
is
thrown if the requested protocol is not available.
public vir tual Stream GetRequestStream( )
Returns an output stream associated with the
previously requested URI.
public vir tual WebResponse GetResponse( )
Sends the previously created request and waits
for a response. When a response is received, it is
returned as a
WebReponse
object. Your program
will use this object to obtain information from the
specified URI.
T
ABLE
25-1
The Methods Defi ned by
WebRequest
that Suppor t Synchronous Communications
Property
Description
public AuthenticationLevel
AuthenticationLevel( get; set; }
Obtains or sets the authentication level.
public vir tual RequestCachePolicy
CachePolicy { get; set; }
Obtains or sets the cache policy, which controls
when a response can be obtained from the cache.
public vir tual string
ConnectionGroupName { get; set; }
Obtains or sets the connection group name.
Connection groups are a way of creating a set of
requests. They are not needed for simple Internet
transactions.
public vir tual long ContentLength { get; set; }
Obtains or sets the length of the content.
public vir tual string ContentType { get; set; }
Obtains or sets the description of the content.
public vir tual ICredentials
Credentials { get; set; }
Obtains or sets credentials.
public static RequestCachePolicy
DefaultCachePolicy { get; set; }
Obtains or sets the default cache policy, which
controls when a request can be obtained from the
cache.
T
ABLE
25-2
The Proper ties Defi ned by
WebRequest
www.freepdf-books.com
826
P a r t I I :
E x p l o r i n g t h e C # L i b r a r y
Do'stlaringiz bilan baham: |