1 <Type Name="WebRequest" FullName="System.Net.WebRequest" FullNameSP="System_Net_WebRequest" Maintainer="ecma">
2 <TypeSignature Language="ILASM" Value=".class public abstract serializable WebRequest extends System.MarshalByRefObject" />
3 <TypeSignature Language="C#" Value="public abstract class WebRequest : MarshalByRefObject, System.Runtime.Serialization.ISerializable" />
4 <TypeSignature Language="ILAsm" Value=".class public auto ansi abstract serializable WebRequest extends System.MarshalByRefObject implements class System.Runtime.Serialization.ISerializable" />
5 <MemberOfLibrary>Networking</MemberOfLibrary>
7 <AssemblyName>System</AssemblyName>
8 <AssemblyPublicKey>[00 00 00 00 00 00 00 00 04 00 00 00 00 00 00 00 ]</AssemblyPublicKey>
9 <AssemblyVersion>1.0.x.x</AssemblyVersion>
10 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
11 <AssemblyVersion>2.0.0.0</AssemblyVersion>
12 <AssemblyVersion>4.0.0.0</AssemblyVersion>
14 <ThreadingSafetyStatement>All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.</ThreadingSafetyStatement>
16 <BaseTypeName>System.MarshalByRefObject</BaseTypeName>
20 <InterfaceName>System.Runtime.Serialization.ISerializable</InterfaceName>
25 <para>Makes a request to a Uniform Resource Identifier
30 <see cref="T:System.Net.WebRequest" /> is an abstract
32 the request side of transactions used for accessing data from the
34 <para> Classes that derive from <see cref="T:System.Net.WebRequest" /> are required to override the following members
35 of the <see cref="T:System.Net.WebRequest" /> class in a
36 protocol-specific manner: </para>
40 <see cref="P:System.Net.WebRequest.Method" />
41 -- Gets or sets the protocol method to use in the current instance.</term>
45 <see cref="P:System.Net.WebRequest.RequestUri" /> --
46 Gets the <see cref="T:System.Uri" /> of the resource associated with the current instance.</term>
50 <see cref="P:System.Net.WebRequest.Headers" />
51 -- Gets or sets the collection of header name/value pairs associated with the
56 <see cref="P:System.Net.WebRequest.ContentLength" /> -- Gets or sets the content length of
57 the request data being sent.</term>
61 <see cref="P:System.Net.WebRequest.ContentType" /> -- Gets or sets the content type of the
62 request data being sent.</term>
66 <see cref="P:System.Net.WebRequest.Credentials" /> -- Gets or sets the credentials used
67 for authenticating the client using the current instance.</term>
71 <see cref="P:System.Net.WebRequest.PreAuthenticate" /> -- Gets or
72 sets a value that indicates whether to send authentication information with a
73 request for resources.</term>
77 <see cref="M:System.Net.WebRequest.GetRequestStream" /> -- Returns a <see cref="T:System.IO.Stream" /> for writing data to a
82 <see cref="M:System.Net.WebRequest.BeginGetRequestStream(System.AsyncCallback,System.Object)" /> -- Begins
83 an asynchronous request for a stream in which to write data to be sent in the
84 current request.</term>
88 <see cref="M:System.Net.WebRequest.EndGetRequestStream(System.IAsyncResult)" /> -- Returns
89 a <see cref="T:System.IO.Stream" /> for writing data to the
90 resource accessed by the current instance.</term>
94 <see cref="M:System.Net.WebRequest.GetResponse" /> -- Returns a response to a request.</term>
98 <see cref="M:System.Net.WebRequest.BeginGetResponse(System.AsyncCallback,System.Object)" /> -- Begins
99 an asynchronous request for a resource.</term>
103 <see cref="M:System.Net.WebRequest.EndGetResponse(System.IAsyncResult)" /> -- Returns a <see cref="T:System.Net.WebResponse" /> that
104 contains a response to a specified pending request.</term>
107 <para>In addition, derived classes are required to
108 support the <see cref="T:System.Net.IWebRequestCreate" /> interface.</para>
109 <block subset="none" type="note">
110 <para> An application
111 that uses the request/response model can request data be
112 sent from the Internet in a protocol-agnostic manner, in which the application works with
113 instances of the <see cref="T:System.Net.WebRequest" /> class while classes that derive from <see cref="T:System.Net.WebRequest" /> and
116 specific protocols perform the details of
118 <para> Requests are sent from an application to a particular Uniform Resource Identifier (URI), such as
119 a Web page on a server. Using the URI, the <see cref="M:System.Net.WebRequest.Create(System.Uri)" /> method creates an instance of a type
120 derived from <see cref="T:System.Net.WebRequest" /> to handle the request. The type is selected from the
121 set of registered types. Types may be registered to handle a specific
122 protocol, such as HTTP or FTP, or to handle a request to a specific server or
123 path on a server. <block subset="none" type="note">For information on registering types, see <see cref="M:System.Net.WebRequest.RegisterPrefix(System.String,System.Net.IWebRequestCreate)" />.</block></para>
124 <para>The <see cref="T:System.Net.WebRequest" /> class throws a <see cref="T:System.Net.WebException" /> exception when an error occurs
125 while accessing a resource. </para>
126 <para> Use the <see cref="M:System.Net.WebRequest.Create(System.Uri,System.Boolean)" /> method to initialize a new instance of a
127 class that derives from <see cref="T:System.Net.WebRequest" />
128 . Do not use the <see cref="T:System.Net.WebRequest" />
132 If the environment variable http_proxy is set, this specifies the proxy to be used for HTTP requests; The format of this string is the url of the proxy server.
136 <para> The following example demonstrates using <see cref="M:System.Net.WebRequest.Create(System.Uri,System.Boolean)" /> to create an instance of
137 <see cref="T:System.Net.HttpWebRequest" />
139 <code lang="C#">using System;
142 public class WebRequestExample {
144 public static void Main() {
146 // Initialize the WebRequest.
147 WebRequest myRequest =
148 WebRequest.Create("http://www.contoso.com");
150 // Print the type of the request.
151 Console.WriteLine(myRequest);
155 <para>The output is</para>
156 <para>System.Net.HttpWebRequest</para>
160 <Member MemberName=".ctor">
161 <MemberSignature Language="ILASM" Value="family rtspecialname specialname instance void .ctor()" />
162 <MemberSignature Language="C#" Value="protected WebRequest ();" />
163 <MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor() cil managed" />
164 <MemberType>Constructor</MemberType>
166 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
167 <AssemblyVersion>2.0.0.0</AssemblyVersion>
168 <AssemblyVersion>4.0.0.0</AssemblyVersion>
174 <para> Constructs a new instance of the <see cref="T:System.Net.WebRequest" />
178 <para>This constructor is called only by classes that derive from
179 <see cref="T:System.Net.WebRequest" />.</para>
181 <block subset="none" type="note">Use the <see cref="M:System.Net.WebRequest.Create(System.Uri,System.Boolean)" /> method to initialize a new instance of a class that derives from <see cref="T:System.Net.WebRequest" /> . Do not use
182 this constructor.</block>
186 <Excluded>0</Excluded>
188 <Member MemberName=".ctor">
189 <MemberSignature Language="C#" Value="protected WebRequest (System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext);" />
190 <MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor(class System.Runtime.Serialization.SerializationInfo serializationInfo, valuetype System.Runtime.Serialization.StreamingContext streamingContext) cil managed" />
191 <MemberType>Constructor</MemberType>
193 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
194 <AssemblyVersion>2.0.0.0</AssemblyVersion>
195 <AssemblyVersion>4.0.0.0</AssemblyVersion>
198 <Parameter Name="serializationInfo" Type="System.Runtime.Serialization.SerializationInfo" />
199 <Parameter Name="streamingContext" Type="System.Runtime.Serialization.StreamingContext" />
202 <param name="serializationInfo">To be added.</param>
203 <param name="streamingContext">To be added.</param>
204 <summary>To be added.</summary>
205 <remarks>To be added.</remarks>
208 <Member MemberName="Abort">
209 <MemberSignature Language="ILASM" Value=".method public hidebysig virtual void Abort()" />
210 <MemberSignature Language="C#" Value="public virtual void Abort ();" />
211 <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Abort() cil managed" />
212 <MemberType>Method</MemberType>
214 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
215 <AssemblyVersion>2.0.0.0</AssemblyVersion>
216 <AssemblyVersion>4.0.0.0</AssemblyVersion>
219 <ReturnType>System.Void</ReturnType>
224 <para> Attempts to cancel an asynchronous request made by the current instance to access a resource.</para>
228 <block subset="none" type="behaviors">As described above.</block>
231 <block subset="none" type="default">The <see cref="T:System.Net.WebRequest" /> class is
232 abstract and does not provide an implementation for this method. This method
233 throws <see cref="T:System.NotSupportedException" />.</block>
236 <block subset="none" type="overrides">This
237 method must be overridden by classes that inherit from <see cref="T:System.Net.WebRequest" /> to provide this
238 functionality. </block>
241 <block subset="none" type="usage">Use this method to cancel an asynchronous operation started with the
242 <see cref="M:System.Net.WebRequest.BeginGetResponse(System.AsyncCallback,System.Object)" /> method.</block>
245 <exception cref="T:System.NotSupportedException">This method is not overridden in the derived class.</exception>
247 <Excluded>0</Excluded>
249 <Member MemberName="AuthenticationLevel">
250 <MemberSignature Language="C#" Value="public System.Net.Security.AuthenticationLevel AuthenticationLevel { get; set; }" />
251 <MemberSignature Language="ILAsm" Value=".property instance valuetype System.Net.Security.AuthenticationLevel AuthenticationLevel" />
252 <MemberType>Property</MemberType>
254 <AssemblyVersion>2.0.0.0</AssemblyVersion>
255 <AssemblyVersion>4.0.0.0</AssemblyVersion>
258 <ReturnType>System.Net.Security.AuthenticationLevel</ReturnType>
261 <summary>To be added.</summary>
262 <value>To be added.</value>
263 <remarks>To be added.</remarks>
266 <Member MemberName="BeginGetRequestStream">
267 <MemberSignature Language="ILASM" Value=".method public hidebysig virtual class System.IAsyncResult BeginGetRequestStream(class System.AsyncCallback callback, object state)" />
268 <MemberSignature Language="C#" Value="public virtual IAsyncResult BeginGetRequestStream (AsyncCallback callback, object state);" />
269 <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.IAsyncResult BeginGetRequestStream(class System.AsyncCallback callback, object state) cil managed" />
270 <MemberType>Method</MemberType>
272 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
273 <AssemblyVersion>2.0.0.0</AssemblyVersion>
274 <AssemblyVersion>4.0.0.0</AssemblyVersion>
277 <ReturnType>System.IAsyncResult</ReturnType>
280 <Parameter Name="callback" Type="System.AsyncCallback" />
281 <Parameter Name="state" Type="System.Object" />
284 <param name="callback">A <see cref="T:System.AsyncCallback" /> delegate to be called when the stream is available. Can be <see langword="null" /> .</param>
285 <param name="state">A <see cref="T:System.Object" /> containing state information for the asynchronous request.</param>
287 <para>Begins an asynchronous request for a stream in which to write data to be sent
288 in the current request.</para>
291 <para> A <see cref="T:System.IAsyncResult" /> object that contains information about the asynchronous operation.</para>
294 <para>The <paramref name="state" /> parameter can be any object that the
295 caller wishes to have available for the duration of the asynchronous operation.
296 This object is available via the <see cref="P:System.IAsyncResult.AsyncState" /> property of the object returned by this
298 <block subset="none" type="behaviors">
299 <para>This method starts an asynchronous operation to obtain a stream
300 used to write data to be sent in the current request. To get the request
301 stream, call the <see cref="M:System.Net.WebRequest.EndGetRequestStream(System.IAsyncResult)" /> method and specify the <see cref="T:System.IAsyncResult" /> object
302 returned by this method.</para>
303 <para>If the <paramref name="callback" /> parameter is not
304 <see langword="null" /> , the
305 method referenced by <paramref name="callback" /> is invoked when the asynchronous
306 operation completes. The <see cref="T:System.IAsyncResult" /> object returned by this method is passed as the argument
307 to the method referenced by <paramref name="callback" />.</para>
310 <block subset="none" type="default">The <see cref="T:System.Net.WebRequest" /> class is
311 abstract and does not provide an implementation for this method. This method
312 throws <see cref="T:System.NotSupportedException" />.</block>
315 <block subset="none" type="overrides">This method must be overridden by classes that inherit from
316 <see cref="T:System.Net.WebRequest" /> to provide this
317 functionality. </block>
320 <block subset="none" type="usage">Use this method to
321 start an asynchronous request for a stream used to send data to a resource. The
322 <paramref name="callback" /> delegate
324 the <see cref="M:System.Net.WebRequest.EndGetRequestStream(System.IAsyncResult)" /> method to
325 obtain the request stream. </block>
328 <exception cref="T:System.NotSupportedException">This method is not overridden in the derived class.</exception>
330 <Excluded>0</Excluded>
332 <Member MemberName="BeginGetResponse">
333 <MemberSignature Language="ILASM" Value=".method public hidebysig virtual class System.IAsyncResult BeginGetResponse(class System.AsyncCallback callback, object state)" />
334 <MemberSignature Language="C#" Value="public virtual IAsyncResult BeginGetResponse (AsyncCallback callback, object state);" />
335 <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.IAsyncResult BeginGetResponse(class System.AsyncCallback callback, object state) cil managed" />
336 <MemberType>Method</MemberType>
338 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
339 <AssemblyVersion>2.0.0.0</AssemblyVersion>
340 <AssemblyVersion>4.0.0.0</AssemblyVersion>
343 <ReturnType>System.IAsyncResult</ReturnType>
346 <Parameter Name="callback" Type="System.AsyncCallback" />
347 <Parameter Name="state" Type="System.Object" />
350 <param name="callback">A <see cref="T:System.AsyncCallback" /> delegate to be called when the response from the server is available.</param>
351 <param name="state">A <see cref="T:System.Object" /> containing state information for the asynchronous request.</param>
353 <para>Begins sending the current request asynchronously.</para>
356 <para> A <see cref="T:System.IAsyncResult" /> object that contains information about the asynchronous operation. </para>
359 <para>The <paramref name="state" /> parameter can be any object that the caller wishes to have
360 available for the duration of the asynchronous operation. This object is
361 available via the <see cref="P:System.IAsyncResult.AsyncState" /> property of the object returned by this
363 <block subset="none" type="behaviors">
364 <para>This method starts an asynchronous operation to send the current request and
365 receive the response from the server that processed the
366 request. To get the response, call the <see cref="M:System.Net.WebRequest.EndGetResponse(System.IAsyncResult)" /> method and specify the <see cref="T:System.IAsyncResult" /> object
367 returned by this method.</para>
368 <para>If the <paramref name="callback" /> parameter is not <see langword="null" /> , the method
369 referenced by <paramref name="callback" /> is invoked when the asynchronous operation
370 completes. The <see cref="T:System.IAsyncResult" /> object returned by this method is passed as the argument
371 to the method referenced by <paramref name="callback" />.</para>
374 <block subset="none" type="default">The <see cref="T:System.Net.WebRequest" /> class is abstract and does not
375 provide an implementation for this method. This method throws <see cref="T:System.NotSupportedException" />.</block>
378 <block subset="none" type="overrides">This method must be overridden by
379 classes that inherit from <see cref="T:System.Net.WebRequest" /> to provide this functionality.
382 <block subset="none" type="usage">The <see cref="M:System.Net.WebRequest.BeginGetResponse(System.AsyncCallback,System.Object)" /> method starts an asynchronous request for
383 a response. The callback delegate
384 can call the <see cref="M:System.Net.WebRequest.EndGetResponse(System.IAsyncResult)" /> method to return the <see cref="T:System.Net.WebResponse" /> received from the resource.</block>
386 <exception cref="T:System.NotSupportedException">This method is not overridden in the derived class.</exception>
388 <Excluded>0</Excluded>
390 <Member MemberName="CachePolicy">
391 <MemberSignature Language="C#" Value="public virtual System.Net.Cache.RequestCachePolicy CachePolicy { get; set; }" />
392 <MemberSignature Language="ILAsm" Value=".property instance class System.Net.Cache.RequestCachePolicy CachePolicy" />
393 <MemberType>Property</MemberType>
395 <AssemblyVersion>2.0.0.0</AssemblyVersion>
396 <AssemblyVersion>4.0.0.0</AssemblyVersion>
400 <AttributeName>System.MonoTODO("Implement the caching system. Currently always returns a policy with the NoCacheNoStore level")</AttributeName>
404 <ReturnType>System.Net.Cache.RequestCachePolicy</ReturnType>
407 <summary>To be added.</summary>
408 <value>To be added.</value>
409 <remarks>To be added.</remarks>
412 <Member MemberName="ConnectionGroupName">
413 <MemberSignature Language="ILASM" Value=".property string ConnectionGroupName { public hidebysig virtual specialname string get_ConnectionGroupName() public hidebysig virtual specialname void set_ConnectionGroupName(string value) }" />
414 <MemberSignature Language="C#" Value="public virtual string ConnectionGroupName { get; set; }" />
415 <MemberSignature Language="ILAsm" Value=".property instance string ConnectionGroupName" />
416 <MemberType>Property</MemberType>
418 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
419 <AssemblyVersion>2.0.0.0</AssemblyVersion>
420 <AssemblyVersion>4.0.0.0</AssemblyVersion>
423 <ReturnType>System.String</ReturnType>
428 <para> Gets or sets the name of the connection group for the current instance.</para>
431 <para> A <see cref="T:System.String" /> that contains the name of the connection group for the current instance.</para>
434 <para>This property associates specific requests within an
435 application with a <see cref="T:System.Net.ServicePoint" />
438 <block subset="none" type="behaviors">As described above.</block>
441 <block subset="none" type="default">This property throws <see cref="T:System.NotSupportedException" />.</block>
444 <block subset="none" type="overrides">This property is required to be
445 overridden by classes that inherit from <see cref="T:System.Net.WebRequest" />. The <see cref="P:System.Net.WebRequest.ConnectionGroupName" /> property
446 typically associates a group of requests that share a set of credentials with a
447 connection to an Internet resource to avoid potential security failures.
451 <block subset="none" type="usage" />Use this property to get or set the name of the connection group for the current instance.</para>
453 <exception cref="T:System.NotSupportedException">This property is not implemented in the derived class.</exception>
455 <Excluded>0</Excluded>
457 <Member MemberName="ContentLength">
458 <MemberSignature Language="ILASM" Value=".property int64 ContentLength { public hidebysig virtual specialname int64 get_ContentLength() public hidebysig virtual specialname void set_ContentLength(int64 value) }" />
459 <MemberSignature Language="C#" Value="public virtual long ContentLength { get; set; }" />
460 <MemberSignature Language="ILAsm" Value=".property instance int64 ContentLength" />
461 <MemberType>Property</MemberType>
463 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
464 <AssemblyVersion>2.0.0.0</AssemblyVersion>
465 <AssemblyVersion>4.0.0.0</AssemblyVersion>
468 <ReturnType>System.Int64</ReturnType>
476 length of the request data being sent.</para>
479 <para>A <see cref="T:System.Int64" /> containing the number of bytes of request data being sent.</para>
483 <block subset="none" type="behaviors">This property
484 is required to throw a <see cref="T:System.InvalidOperationException" /> exception if data has already been
485 written to the request stream, and a <see cref="T:System.ArgumentOutOfRangeException" /> exception if the property is being set to a value less than zero.</block>
488 <block subset="none" type="default">This property throws <see cref="T:System.NotSupportedException" />.</block>
491 <block subset="none" type="overrides">This property is required to be
492 overridden by classes that inherit from <see cref="T:System.Net.WebRequest" />.</block>
495 <block subset="none" type="usage">Use this property to get the number of bytes sent to the resource.</block>
498 <exception cref="T:System.NotSupportedException">This property is not implemented in the derived class. </exception>
499 <exception cref="T:System.InvalidOperationException">Data has already been written to the request stream. </exception>
500 <exception cref="T:System.ArgumentOutOfRangeException">This property is being set to a value less than zero. </exception>
502 <Excluded>0</Excluded>
504 <Member MemberName="ContentType">
505 <MemberSignature Language="ILASM" Value=".property string ContentType { public hidebysig virtual specialname string get_ContentType() public hidebysig virtual specialname void set_ContentType(string value) }" />
506 <MemberSignature Language="C#" Value="public virtual string ContentType { get; set; }" />
507 <MemberSignature Language="ILAsm" Value=".property instance string ContentType" />
508 <MemberType>Property</MemberType>
510 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
511 <AssemblyVersion>2.0.0.0</AssemblyVersion>
512 <AssemblyVersion>4.0.0.0</AssemblyVersion>
515 <ReturnType>System.String</ReturnType>
523 the content type of the request data being sent.</para>
526 <para> A <see cref="T:System.String" /> that represents the content type of the request data.</para>
529 <para>The <see cref="P:System.Net.WebRequest.ContentType" />
530 property contains the media type of the request.</para>
532 <block subset="none" type="note">This
533 is typically the MIME encoding of the content.</block>
536 <block subset="none" type="behaviors">As described above.</block>
539 <block subset="none" type="default">This property throws <see cref="T:System.NotSupportedException" />.</block>
542 <block subset="none" type="overrides">This property is required to be
543 overridden by classes that inherit from <see cref="T:System.Net.WebRequest" />.</block>
546 <block subset="none" type="usage">Use
547 this property to get the media type of request.</block>
550 <exception cref="T:System.NotSupportedException">This property is not implemented in the derived class. </exception>
552 <Excluded>0</Excluded>
554 <Member MemberName="Create">
555 <MemberSignature Language="ILASM" Value=".method public hidebysig static class System.Net.WebRequest Create(string requestUriString)" />
556 <MemberSignature Language="C#" Value="public static System.Net.WebRequest Create (string requestUriString);" />
557 <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Net.WebRequest Create(string requestUriString) cil managed" />
558 <MemberType>Method</MemberType>
560 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
561 <AssemblyVersion>2.0.0.0</AssemblyVersion>
562 <AssemblyVersion>4.0.0.0</AssemblyVersion>
565 <ReturnType>System.Net.WebRequest</ReturnType>
568 <Parameter Name="requestUriString" Type="System.String" />
571 <param name="requestUriString">A <see cref="T:System.String" /> that contains a URI.</param>
573 <para> Constructs a new instance of a class derived from <see cref="T:System.Net.WebRequest" />. The new instance is of the
574 type registered for the scheme
575 of the specified URI.</para>
578 <para>A new instance of a class that derived from <see cref="T:System.Net.WebRequest" /> and is registered to handle the
579 scheme of <paramref name="requestUriString" />.</para>
582 <block subset="none" type="note">
584 returns a new instance of a class that derived from
585 <see cref="T:System.Net.WebRequest" /> . The <see cref="T:System.Type" /> of this new instance
586 is determined at run time by the scheme of the URI in
587 <paramref name="requestUriString" />. For example,
588 when a URI beginning with <c>http://</c> is passed in
589 <paramref name="requestUriString" />, a <see cref="T:System.Net.HttpWebRequest" /> instance is returned.</para>
590 <para> Classes that derive from <see cref="T:System.Net.WebRequest" /> that are
591 created to handle other requests are registered
592 with the <see cref="M:System.Net.WebRequest.RegisterPrefix(System.String,System.Net.IWebRequestCreate)" />
596 <exception cref="T:System.ArgumentNullException">
597 <paramref name="requestUriString " />is <see langword="null" />.</exception>
598 <exception cref="T:System.NotSupportedException">The request scheme specified in <paramref name="requestUri " /> is not registered.</exception>
599 <exception cref="T:System.UriFormatException">The URI specified in <paramref name="requestUriString" /> is not a valid URI.</exception>
600 <exception cref="T:System.Security.SecurityException">The caller does not have permission to connect to the requested URI or a URI that the request is redirected to.</exception>
601 <permission cref="!:System.Security.Permissions.WebPermission">Requires permission to connect to the requested URI. See <see cref="F:System.Net.NetworkAccess.Connect" />.</permission>
603 <Excluded>0</Excluded>
605 <Member MemberName="Create">
606 <MemberSignature Language="ILASM" Value=".method public hidebysig static class System.Net.WebRequest Create(class System.Uri requestUri)" />
607 <MemberSignature Language="C#" Value="public static System.Net.WebRequest Create (Uri requestUri);" />
608 <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Net.WebRequest Create(class System.Uri requestUri) cil managed" />
609 <MemberType>Method</MemberType>
611 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
612 <AssemblyVersion>2.0.0.0</AssemblyVersion>
613 <AssemblyVersion>4.0.0.0</AssemblyVersion>
616 <ReturnType>System.Net.WebRequest</ReturnType>
619 <Parameter Name="requestUri" Type="System.Uri" />
622 <param name="requestUri">A <see cref="T:System.Uri" /> containing the URI of the requested resource.</param>
624 Constructs a new instance of a class derived from <see cref="T:System.Net.WebRequest" />.
627 <para> A new instance of a class derived from <see cref="T:System.Net.WebRequest" /> that is registered to handle the closest registered
628 match for <paramref name="requestUri" />.</para>
632 determine the closest match, this method checks the registered URIs for the
633 longest URI prefix that matches <paramref name="requestUri" />. </para>
634 <block subset="none" type="note">
635 <para>For an example that demonstrates this method, see <see cref="M:System.Net.WebRequest.CreateDefault(System.Uri)" />.</para>
638 <exception cref="T:System.ArgumentNullException">
639 <paramref name="requestUri " />is <see langword="null" />.</exception>
640 <exception cref="T:System.NotSupportedException">The request scheme specified in <paramref name="requestUri " /> is not registered.</exception>
641 <exception cref="T:System.Security.SecurityException">The caller does not have permission to connect to the requested URI or a URI that the request is redirected to.</exception>
642 <permission cref="!:System.Security.Permissions.WebPermission">Requires permission to connect to the requested URI. See <see cref="F:System.Net.NetworkAccess.Connect" />.</permission>
644 <Excluded>0</Excluded>
646 <Member MemberName="CreateDefault">
647 <MemberSignature Language="ILASM" Value=".method public hidebysig static class System.Net.WebRequest CreateDefault(class System.Uri requestUri)" />
648 <MemberSignature Language="C#" Value="public static System.Net.WebRequest CreateDefault (Uri requestUri);" />
649 <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Net.WebRequest CreateDefault(class System.Uri requestUri) cil managed" />
650 <MemberType>Method</MemberType>
652 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
653 <AssemblyVersion>2.0.0.0</AssemblyVersion>
654 <AssemblyVersion>4.0.0.0</AssemblyVersion>
657 <ReturnType>System.Net.WebRequest</ReturnType>
660 <Parameter Name="requestUri" Type="System.Uri" />
663 <param name="requestUri">A <see cref="T:System.Uri" /> containing the URI of the requested resource.</param>
665 <para> Constructs a new instance of a class derived from <see cref="T:System.Net.WebRequest" />. The new instance is of
666 the type registered for the scheme of the specified URI.</para>
669 <para> A new instance of the type derived from <see cref="T:System.Net.WebRequest" /> that is registered for the scheme of the specified <see cref="T:System.Uri" /> .</para>
673 <block subset="none" type="note">When this method is
674 invoked, only the scheme portion of <paramref name="requestUri " />is checked against the
675 list of URIs registered for the current instance. Conversely, when <see cref="M:System.Net.WebRequest.Create(System.Uri,System.Boolean)" />
676 is invoked, the entire URI is checked against the
677 list of registered URIs.
681 <exception cref="T:System.ArgumentNullException">
682 <paramref name="requestUri" /> is <see langword="null" />.</exception>
683 <exception cref="T:System.NotSupportedException">The request scheme specified in <paramref name="requestUri " /> is not registered.</exception>
684 <exception cref="T:System.Security.SecurityException">The caller does not have permission to connect to the requested URI or a URI that the request is redirected to.</exception>
685 <permission cref="!:System.Security.Permissions.WebPermission">Requires permission to connect to the requested URI. See <see cref="F:System.Net.NetworkAccess.Connect" />.</permission>
687 <para>This example demonstrates the use of the <see cref="M:System.Net.WebRequest.Create(System.Uri,System.Boolean)" /> and <see cref="M:System.Net.WebRequest.CreateDefault(System.Uri)" /> methods.</para>
688 <code lang="C#">using System;
691 public class ContosoTextRequest : WebRequest, IWebRequestCreate
693 public new WebRequest Create(Uri uri)
695 return new ContosoTextRequest();
699 public class CreateDefaultExample
701 public static void Main()
703 ContosoTextRequest contoso = new ContosoTextRequest();
704 Uri contosoUri = new Uri("http://www.contoso.com/text");
705 WebRequest.RegisterPrefix("http://www.contoso.com/text", contoso);
707 WebRequest httpContoso = WebRequest.CreateDefault(contosoUri);
708 Console.WriteLine("CreateDefault --> {0}", httpContoso);
710 WebRequest textContoso = WebRequest.Create(contosoUri);
711 Console.WriteLine("Create --> {0}", textContoso);
715 <para>The output is</para>
717 <para>CreateDefault --> System.Net.HttpWebRequest</para>
719 ContosoTextRequest</para>
723 <Excluded>0</Excluded>
725 <Member MemberName="CreateHttp">
726 <MemberSignature Language="C#" Value="public static System.Net.HttpWebRequest CreateHttp (string requestUriString);" />
727 <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Net.HttpWebRequest CreateHttp(string requestUriString) cil managed" />
728 <MemberType>Method</MemberType>
730 <AssemblyVersion>4.0.0.0</AssemblyVersion>
734 <AttributeName>System.MonoTODO("for portable library support")</AttributeName>
738 <ReturnType>System.Net.HttpWebRequest</ReturnType>
741 <Parameter Name="requestUriString" Type="System.String" />
744 <param name="requestUriString">To be added.</param>
745 <summary>To be added.</summary>
746 <returns>To be added.</returns>
747 <remarks>To be added.</remarks>
750 <Member MemberName="CreateHttp">
751 <MemberSignature Language="C#" Value="public static System.Net.HttpWebRequest CreateHttp (Uri requestUri);" />
752 <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Net.HttpWebRequest CreateHttp(class System.Uri requestUri) cil managed" />
753 <MemberType>Method</MemberType>
755 <AssemblyVersion>4.0.0.0</AssemblyVersion>
759 <AttributeName>System.MonoTODO("for portable library support")</AttributeName>
763 <ReturnType>System.Net.HttpWebRequest</ReturnType>
766 <Parameter Name="requestUri" Type="System.Uri" />
769 <param name="requestUri">To be added.</param>
770 <summary>To be added.</summary>
771 <returns>To be added.</returns>
772 <remarks>To be added.</remarks>
775 <Member MemberName="Credentials">
776 <MemberSignature Language="ILASM" Value=".property class System.Net.ICredentials Credentials { public hidebysig virtual specialname class System.Net.ICredentials get_Credentials() public hidebysig virtual specialname void set_Credentials(class System.Net.ICredentials value) }" />
777 <MemberSignature Language="C#" Value="public virtual System.Net.ICredentials Credentials { get; set; }" />
778 <MemberSignature Language="ILAsm" Value=".property instance class System.Net.ICredentials Credentials" />
779 <MemberType>Property</MemberType>
781 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
782 <AssemblyVersion>2.0.0.0</AssemblyVersion>
783 <AssemblyVersion>4.0.0.0</AssemblyVersion>
786 <ReturnType>System.Net.ICredentials</ReturnType>
791 <para> Gets or sets the credentials used for
792 authenticating the client using the current instance.</para>
795 <para> A <see cref="T:System.Net.ICredentials" /> object containing the authentication credentials
796 associated with the request. The default is <see langword="null" /> .</para>
800 <block subset="none" type="behaviors">As described above.</block>
803 <block subset="none" type="default">This
804 property throws <see cref="T:System.NotSupportedException" />.</block>
807 <block subset="none" type="overrides">This
808 property is required to be overridden by classes that inherit from
809 <see cref="T:System.Net.WebRequest" />.</block>
812 <block subset="none" type="usage">Use this property
813 to store or access the user, password, and domain information of the current instance.</block>
816 <exception cref="T:System.NotSupportedException">This property is not implemented in the derived class. </exception>
818 <Excluded>0</Excluded>
820 <Member MemberName="DefaultCachePolicy">
821 <MemberSignature Language="C#" Value="public static System.Net.Cache.RequestCachePolicy DefaultCachePolicy { get; set; }" />
822 <MemberSignature Language="ILAsm" Value=".property class System.Net.Cache.RequestCachePolicy DefaultCachePolicy" />
823 <MemberType>Property</MemberType>
825 <AssemblyVersion>2.0.0.0</AssemblyVersion>
826 <AssemblyVersion>4.0.0.0</AssemblyVersion>
829 <ReturnType>System.Net.Cache.RequestCachePolicy</ReturnType>
832 <summary>To be added.</summary>
833 <value>To be added.</value>
834 <remarks>To be added.</remarks>
837 <Member MemberName="DefaultWebProxy">
838 <MemberSignature Language="C#" Value="public static System.Net.IWebProxy DefaultWebProxy { get; set; }" />
839 <MemberSignature Language="ILAsm" Value=".property class System.Net.IWebProxy DefaultWebProxy" />
840 <MemberType>Property</MemberType>
842 <AssemblyVersion>2.0.0.0</AssemblyVersion>
843 <AssemblyVersion>4.0.0.0</AssemblyVersion>
846 <ReturnType>System.Net.IWebProxy</ReturnType>
849 <summary>To be added.</summary>
850 <value>To be added.</value>
851 <remarks>To be added.</remarks>
854 <Member MemberName="EndGetRequestStream">
855 <MemberSignature Language="ILASM" Value=".method public hidebysig virtual class System.IO.Stream EndGetRequestStream(class System.IAsyncResult asyncResult)" />
856 <MemberSignature Language="C#" Value="public virtual System.IO.Stream EndGetRequestStream (IAsyncResult asyncResult);" />
857 <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.IO.Stream EndGetRequestStream(class System.IAsyncResult asyncResult) cil managed" />
858 <MemberType>Method</MemberType>
860 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
861 <AssemblyVersion>2.0.0.0</AssemblyVersion>
862 <AssemblyVersion>4.0.0.0</AssemblyVersion>
865 <ReturnType>System.IO.Stream</ReturnType>
868 <Parameter Name="asyncResult" Type="System.IAsyncResult" />
871 <param name="asyncResult">A <see cref="T:System.IAsyncResult" /> object that references a request for a <see cref="T:System.IO.Stream" /> started with <see cref="M:System.Net.WebRequest.BeginGetRequestStream(System.AsyncCallback,System.Object)" /> .</param>
873 <para> Returns a <see cref="T:System.IO.Stream" /> for writing data to the resource identified by the
874 <see cref="P:System.Net.WebRequest.RequestUri" /> property of the current instance.</para>
877 <para> A <see cref="T:System.IO.Stream" /> to write data
881 <para> This method completes an asynchronous
882 request for a stream that was started by the <see cref="M:System.Net.WebRequest.BeginGetRequestStream(System.AsyncCallback,System.Object)" /> method.</para>
884 <block subset="none" type="behaviors">As described above.
888 <block subset="none" type="default">The <see cref="T:System.Net.WebRequest" /> class is
889 abstract and does not provide an implementation for this method. This method
890 throws <see cref="T:System.NotSupportedException" />.</block>
893 <block subset="none" type="overrides">This
894 method must be overridden by classes that inherit from <see cref="T:System.Net.WebRequest" /> to provide this
895 functionality. </block>
897 <block subset="none" type="usage">
898 <para>Use this method to complete an asynchronous request for a stream that was started with the <see cref="M:System.Net.WebRequest.BeginGetRequestStream(System.AsyncCallback,System.Object)" /> method.</para>
901 <exception cref="T:System.NotSupportedException">This method is not overridden in the derived class.</exception>
902 <exception cref="T:System.ArgumentException">
903 <paramref name="asyncResult" /> was not returned by a call to <see cref="M:System.Net.WebRequest.BeginGetRequestStream(System.AsyncCallback,System.Object)" />.</exception>
904 <exception cref="T:System.ArgumentNullException">
905 <paramref name="asyncResult" /> is a null reference. </exception>
906 <exception cref="T:System.InvalidOperationException">
907 <para> This method was called previously using <paramref name="asyncResult." /></para>
909 <para>No stream is available.</para>
911 <exception cref="T:System.Net.WebException">An error occurred while processing the request.</exception>
913 <Excluded>0</Excluded>
915 <Member MemberName="EndGetResponse">
916 <MemberSignature Language="ILASM" Value=".method public hidebysig virtual class System.Net.WebResponse EndGetResponse(class System.IAsyncResult asyncResult)" />
917 <MemberSignature Language="C#" Value="public virtual System.Net.WebResponse EndGetResponse (IAsyncResult asyncResult);" />
918 <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Net.WebResponse EndGetResponse(class System.IAsyncResult asyncResult) cil managed" />
919 <MemberType>Method</MemberType>
921 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
922 <AssemblyVersion>2.0.0.0</AssemblyVersion>
923 <AssemblyVersion>4.0.0.0</AssemblyVersion>
926 <ReturnType>System.Net.WebResponse</ReturnType>
929 <Parameter Name="asyncResult" Type="System.IAsyncResult" />
932 <param name="asyncResult">A <see cref="T:System.IAsyncResult" /> object that references a pending request that was started with <see cref="M:System.Net.WebRequest.BeginGetResponse(System.AsyncCallback,System.Object)" />.</param>
934 <para> Returns a <see cref="T:System.Net.WebResponse" /> that contains a response to a specified
935 pending request.</para>
938 <para> A <see cref="T:System.Net.WebResponse" /> that contains a response to the request
939 referenced by <paramref name="asyncResult" />.</para>
943 <block subset="none" type="behaviors">As described
947 <block subset="none" type="default">The <see cref="T:System.Net.WebRequest" /> class is
948 abstract and does not provide an implementation for this method. This method
949 throws <see cref="T:System.NotSupportedException" />.</block>
952 <block subset="none" type="overrides">This
953 method must be overridden by classes that inherit from <see cref="T:System.Net.WebRequest" /> to provide this
954 functionality. </block>
957 <block subset="none" type="usage">Use this method to complete an asynchronous request
958 for an Internet resource that was started with the <see cref="M:System.Net.WebRequest.BeginGetResponse(System.AsyncCallback,System.Object)" /> method.
962 <exception cref="T:System.NotSupportedException">This method is not overridden in the derived class.</exception>
963 <exception cref="T:System.ArgumentException">
964 <paramref name="asyncResult" /> was not returned by a call to <see cref="M:System.Net.WebRequest.BeginGetResponse(System.AsyncCallback,System.Object)" />.</exception>
965 <exception cref="T:System.ArgumentNullException">
966 <paramref name="asyncResult" /> is a null reference.</exception>
967 <exception cref="T:System.InvalidOperationException">
968 <para>The <see cref="P:System.Net.WebRequest.ContentLength" /> property of the current instance is greater than zero but no data has been written to the request stream.</para>
970 <para>This method was called previously using <paramref name="asyncResult." /></para>
972 <exception cref="T:System.Net.WebException">An error occurred while processing the request.</exception>
974 <Excluded>0</Excluded>
976 <Member MemberName="GetObjectData">
977 <MemberSignature Language="C#" Value="protected virtual void GetObjectData (System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext);" />
978 <MemberSignature Language="ILAsm" Value=".method familyhidebysig newslot virtual instance void GetObjectData(class System.Runtime.Serialization.SerializationInfo serializationInfo, valuetype System.Runtime.Serialization.StreamingContext streamingContext) cil managed" />
979 <MemberType>Method</MemberType>
981 <AssemblyVersion>2.0.0.0</AssemblyVersion>
982 <AssemblyVersion>4.0.0.0</AssemblyVersion>
985 <ReturnType>System.Void</ReturnType>
988 <Parameter Name="serializationInfo" Type="System.Runtime.Serialization.SerializationInfo" />
989 <Parameter Name="streamingContext" Type="System.Runtime.Serialization.StreamingContext" />
992 <param name="serializationInfo">To be added.</param>
993 <param name="streamingContext">To be added.</param>
994 <summary>To be added.</summary>
995 <remarks>To be added.</remarks>
998 <Member MemberName="GetRequestStream">
999 <MemberSignature Language="ILASM" Value=".method public hidebysig virtual class System.IO.Stream GetRequestStream()" />
1000 <MemberSignature Language="C#" Value="public virtual System.IO.Stream GetRequestStream ();" />
1001 <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.IO.Stream GetRequestStream() cil managed" />
1002 <MemberType>Method</MemberType>
1004 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
1005 <AssemblyVersion>2.0.0.0</AssemblyVersion>
1006 <AssemblyVersion>4.0.0.0</AssemblyVersion>
1009 <ReturnType>System.IO.Stream</ReturnType>
1014 <para> Returns a <see cref="T:System.IO.Stream" /> for writing data to a
1018 <para> A <see cref="T:System.IO.Stream" /> for writing data to
1023 <block subset="none" type="behaviors">As described above.</block>
1026 <block subset="none" type="default">The <see cref="T:System.Net.WebRequest" /> class is abstract and does not
1027 provide an implementation for this method. This method throws <see cref="T:System.NotSupportedException" />.</block>
1030 <block subset="none" type="overrides">This method is required to be
1031 overridden by classes that inherit from <see cref="T:System.Net.WebRequest" />.</block>
1033 <block subset="none" type="usage">
1034 <para> Use this method to initiate a request to send
1035 data to a resource and obtain a <see cref="T:System.IO.Stream" /> instance for sending data to
1036 that resource. </para>
1037 <para>The <see cref="M:System.Net.WebRequest.GetRequestStream" /> method provides synchronous access to the <see cref="T:System.IO.Stream" />. For
1038 asynchronous access, use the <see cref="M:System.Net.WebRequest.BeginGetRequestStream(System.AsyncCallback,System.Object)" /> and <see cref="M:System.Net.WebRequest.EndGetRequestStream(System.IAsyncResult)" /> methods.</para>
1041 <exception cref="T:System.NotSupportedException">This method is not overridden in the derived class.</exception>
1043 <Excluded>0</Excluded>
1045 <Member MemberName="GetRequestStreamAsync">
1046 <MemberSignature Language="C#" Value="public virtual System.Threading.Tasks.Task<System.IO.Stream> GetRequestStreamAsync ();" />
1047 <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Threading.Tasks.Task`1<class System.IO.Stream> GetRequestStreamAsync() cil managed" />
1048 <MemberType>Method</MemberType>
1050 <AssemblyVersion>4.0.0.0</AssemblyVersion>
1053 <ReturnType>System.Threading.Tasks.Task<System.IO.Stream></ReturnType>
1057 <summary>To be added.</summary>
1058 <returns>To be added.</returns>
1059 <remarks>To be added.</remarks>
1062 <Member MemberName="GetResponse">
1063 <MemberSignature Language="ILASM" Value=".method public hidebysig virtual class System.Net.WebResponse GetResponse()" />
1064 <MemberSignature Language="C#" Value="public virtual System.Net.WebResponse GetResponse ();" />
1065 <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Net.WebResponse GetResponse() cil managed" />
1066 <MemberType>Method</MemberType>
1068 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
1069 <AssemblyVersion>2.0.0.0</AssemblyVersion>
1070 <AssemblyVersion>4.0.0.0</AssemblyVersion>
1073 <ReturnType>System.Net.WebResponse</ReturnType>
1079 response to a request.</para>
1082 <para> A <see cref="T:System.Net.WebResponse" /> containing the response to the request.</para>
1085 <block subset="none" type="behaviors">
1086 <para> This method returns an instance of a type
1087 derived from <see cref="T:System.Net.WebResponse" /> that is registered for the <see cref="P:System.Net.WebRequest.RequestUri" /> property of the current instance. This new
1088 instance is required to contain a response from the resource to the current request. </para>
1089 <para>If the timeout period for the request expires, or an
1090 error occurs while processing the request, this method is required to throw a
1091 <see cref="T:System.Net.WebException" /> exception.</para>
1094 <block subset="none" type="default">The <see cref="T:System.Net.WebRequest" /> class is
1095 abstract and does not provide an implementation for this method. This method
1096 throws <see cref="T:System.NotSupportedException" />.</block>
1099 <block subset="none" type="overrides">This
1100 method must be overridden by classes that inherit from <see cref="T:System.Net.WebRequest" /> to provide this
1101 functionality. </block>
1104 <block subset="none" type="usage">Use this method for synchronous access to a resource.
1105 For asynchronous access, use the <see cref="M:System.Net.WebRequest.BeginGetResponse(System.AsyncCallback,System.Object)" /> and <see cref="M:System.Net.WebRequest.EndGetResponse(System.IAsyncResult)" /> methods.</block>
1108 <exception cref="T:System.NotSupportedException">This method is not overridden in the derived class.</exception>
1109 <exception cref="T:System.Net.WebException">
1110 <para> The request timed out.</para>
1112 <para>An error occurred while processing the request.</para>
1115 <Excluded>0</Excluded>
1117 <Member MemberName="GetResponseAsync">
1118 <MemberSignature Language="C#" Value="public virtual System.Threading.Tasks.Task<System.Net.WebResponse> GetResponseAsync ();" />
1119 <MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Threading.Tasks.Task`1<class System.Net.WebResponse> GetResponseAsync() cil managed" />
1120 <MemberType>Method</MemberType>
1122 <AssemblyVersion>4.0.0.0</AssemblyVersion>
1125 <ReturnType>System.Threading.Tasks.Task<System.Net.WebResponse></ReturnType>
1129 <summary>To be added.</summary>
1130 <returns>To be added.</returns>
1131 <remarks>To be added.</remarks>
1134 <Member MemberName="GetSystemWebProxy">
1135 <MemberSignature Language="C#" Value="public static System.Net.IWebProxy GetSystemWebProxy ();" />
1136 <MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Net.IWebProxy GetSystemWebProxy() cil managed" />
1137 <MemberType>Method</MemberType>
1139 <AssemblyVersion>2.0.0.0</AssemblyVersion>
1140 <AssemblyVersion>4.0.0.0</AssemblyVersion>
1144 <AttributeName>System.MonoTODO("Look in other places for proxy config info")</AttributeName>
1148 <ReturnType>System.Net.IWebProxy</ReturnType>
1152 <summary>To be added.</summary>
1153 <returns>To be added.</returns>
1154 <remarks>To be added.</remarks>
1157 <Member MemberName="Headers">
1158 <MemberSignature Language="ILASM" Value=".property class System.Net.WebHeaderCollection Headers { public hidebysig virtual specialname class System.Net.WebHeaderCollection get_Headers() public hidebysig virtual specialname void set_Headers(class System.Net.WebHeaderCollection value) }" />
1159 <MemberSignature Language="C#" Value="public virtual System.Net.WebHeaderCollection Headers { get; set; }" />
1160 <MemberSignature Language="ILAsm" Value=".property instance class System.Net.WebHeaderCollection Headers" />
1161 <MemberType>Property</MemberType>
1163 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
1164 <AssemblyVersion>2.0.0.0</AssemblyVersion>
1165 <AssemblyVersion>4.0.0.0</AssemblyVersion>
1168 <ReturnType>System.Net.WebHeaderCollection</ReturnType>
1175 sets the collection of header name/value pairs associated with the
1179 <para> A <see cref="T:System.Net.WebHeaderCollection" /> containing the header name/value pairs associated
1180 with the current instance.</para>
1183 <para>This property contains a <see cref="T:System.Net.WebHeaderCollection" /> instance containing
1184 the header information to send to resources. </para>
1186 <block subset="none" type="behaviors">As described above.</block>
1189 <block subset="none" type="default">This property
1190 throws a <see cref="T:System.NotSupportedException" />
1194 <block subset="none" type="overrides">This property must be overridden by classes that inherit from
1195 <see cref="T:System.Net.WebRequest" />.</block>
1198 <block subset="none" type="usage">Use this property
1199 to determine the header information of a request.</block>
1202 <exception cref="T:System.NotSupportedException">This property is not implemented in the derived class. </exception>
1204 <Excluded>0</Excluded>
1206 <Member MemberName="ImpersonationLevel">
1207 <MemberSignature Language="C#" Value="public System.Security.Principal.TokenImpersonationLevel ImpersonationLevel { get; set; }" />
1208 <MemberSignature Language="ILAsm" Value=".property instance valuetype System.Security.Principal.TokenImpersonationLevel ImpersonationLevel" />
1209 <MemberType>Property</MemberType>
1211 <AssemblyVersion>2.0.0.0</AssemblyVersion>
1212 <AssemblyVersion>4.0.0.0</AssemblyVersion>
1215 <ReturnType>System.Security.Principal.TokenImpersonationLevel</ReturnType>
1218 <summary>To be added.</summary>
1219 <value>To be added.</value>
1220 <remarks>To be added.</remarks>
1223 <Member MemberName="Method">
1224 <MemberSignature Language="ILASM" Value=".property string Method { public hidebysig virtual specialname string get_Method() public hidebysig virtual specialname void set_Method(string value) }" />
1225 <MemberSignature Language="C#" Value="public virtual string Method { get; set; }" />
1226 <MemberSignature Language="ILAsm" Value=".property instance string Method" />
1227 <MemberType>Property</MemberType>
1229 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
1230 <AssemblyVersion>2.0.0.0</AssemblyVersion>
1231 <AssemblyVersion>4.0.0.0</AssemblyVersion>
1234 <ReturnType>System.String</ReturnType>
1240 or sets the protocol method to use in the current
1244 <para> A <see cref="T:System.String" /> containing the protocol method to use in the current instance.</para>
1248 <block subset="none" type="behaviors">The default value of this property is required to
1249 be a protocol method that does not require protocol-specific properties
1250 to be set. For the HTTP protocol, this
1251 value is GET.</block>
1254 <block subset="none" type="default">This property throws <see cref="T:System.NotSupportedException" />.</block>
1257 <block subset="none" type="overrides">This property must be overridden by
1258 classes that inherit from <see cref="T:System.Net.WebRequest" /> to provide this functionality. </block>
1261 <block subset="none" type="usage">Use this property
1262 to set the protocol-specific method that will be used to make a request.</block>
1265 <exception cref="T:System.NotSupportedException">This property is not implemented in the derived class. </exception>
1267 <Excluded>0</Excluded>
1269 <Member MemberName="PreAuthenticate">
1270 <MemberSignature Language="ILASM" Value=".property bool PreAuthenticate { public hidebysig virtual specialname bool get_PreAuthenticate() public hidebysig virtual specialname void set_PreAuthenticate(bool value) }" />
1271 <MemberSignature Language="C#" Value="public virtual bool PreAuthenticate { get; set; }" />
1272 <MemberSignature Language="ILAsm" Value=".property instance bool PreAuthenticate" />
1273 <MemberType>Property</MemberType>
1275 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
1276 <AssemblyVersion>2.0.0.0</AssemblyVersion>
1277 <AssemblyVersion>4.0.0.0</AssemblyVersion>
1280 <ReturnType>System.Boolean</ReturnType>
1285 <para> Gets or sets a <see cref="T:System.Boolean" /> value that determines whether to send authentication information with the current request instead of waiting
1286 for an authentication challenge
1287 from the requested resource.</para>
1291 <see langword="true" /> if
1292 authentication information will be
1293 sent with the current request without waiting for an authentication challenge
1295 the requested resource;
1296 otherwise, <see langword="false" />.</para>
1300 <block subset="none" type="behaviors">If <see cref="P:System.Net.WebRequest.PreAuthenticate" /> is <see langword="true" /> , the current instance sends authentication
1301 credentials without waiting to be challenged by the server specified by the
1302 <see cref="P:System.Net.WebRequest.RequestUri" />
1303 property of the current instance. When
1304 this property is <see langword="false" /> , the
1305 current instance waits for
1306 a challenge from the server before sending credentials.</block>
1309 <block subset="none" type="default">This
1310 property throws <see cref="T:System.NotSupportedException" />.</block>
1313 <block subset="none" type="overrides">This property must be overridden by
1314 classes that inherit from <see cref="T:System.Net.WebRequest" /> to provide this functionality. </block>
1317 <block subset="none" type="usage">Use this
1318 property to ensure that authentication information is sent with every
1319 request. Setting this property to <see langword="true " /> allows clients to improve
1320 server efficiency by avoiding extra round trips caused by authentication challenges.</block>
1323 <exception cref="T:System.NotSupportedException">This property is not implemented in the derived class. </exception>
1325 <Excluded>0</Excluded>
1327 <Member MemberName="Proxy">
1328 <MemberSignature Language="ILASM" Value=".property class System.Net.IWebProxy Proxy { public hidebysig virtual specialname class System.Net.IWebProxy get_Proxy() public hidebysig virtual specialname void set_Proxy(class System.Net.IWebProxy value) }" />
1329 <MemberSignature Language="C#" Value="public virtual System.Net.IWebProxy Proxy { get; set; }" />
1330 <MemberSignature Language="ILAsm" Value=".property instance class System.Net.IWebProxy Proxy" />
1331 <MemberType>Property</MemberType>
1333 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
1334 <AssemblyVersion>2.0.0.0</AssemblyVersion>
1335 <AssemblyVersion>4.0.0.0</AssemblyVersion>
1338 <ReturnType>System.Net.IWebProxy</ReturnType>
1343 <para> Gets or sets the
1344 network proxy to use to access resources.</para>
1347 <para> A <see cref="T:System.Net.IWebProxy" /> to use to access resources.</para>
1350 <para>The <see cref="P:System.Net.WebRequest.Proxy" /> property identifies the network proxy
1351 that the request uses to access resources. The request is made through the
1352 proxy server rather than directly to the server hosting the resource.</para>
1353 <block subset="none" type="behaviors">
1354 <para>If the <see cref="P:System.Net.WebRequest.Proxy" />
1355 property of the current instance has not been set, the value of this property is
1356 required to be <see langword="null" />
1358 <para>If the property is being set to <see langword="null" />, it is required to
1359 throw a <see cref="T:System.ArgumentNullException" /> exception.</para>
1362 <block subset="none" type="default">This
1363 property throws <see cref="T:System.NotSupportedException" />.</block>
1366 <block subset="none" type="overrides">This property must be overridden by
1367 classes that inherit from <see cref="T:System.Net.WebRequest" /> to provide this functionality. </block>
1370 <block subset="none" type="usage">Use this method to
1371 obtain a <see cref="T:System.Net.IWebProxy" /> instance that represents the proxy server used by the current instance.</block>
1374 <exception cref="T:System.NotSupportedException">This property is not implemented in the derived class. </exception>
1376 <Excluded>0</Excluded>
1378 <Member MemberName="RegisterPrefix">
1379 <MemberSignature Language="ILASM" Value=".method public hidebysig static bool RegisterPrefix(string prefix, class System.Net.IWebRequestCreate creator)" />
1380 <MemberSignature Language="C#" Value="public static bool RegisterPrefix (string prefix, System.Net.IWebRequestCreate creator);" />
1381 <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool RegisterPrefix(string prefix, class System.Net.IWebRequestCreate creator) cil managed" />
1382 <MemberType>Method</MemberType>
1384 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
1385 <AssemblyVersion>2.0.0.0</AssemblyVersion>
1386 <AssemblyVersion>4.0.0.0</AssemblyVersion>
1389 <ReturnType>System.Boolean</ReturnType>
1392 <Parameter Name="prefix" Type="System.String" />
1393 <Parameter Name="creator" Type="System.Net.IWebRequestCreate" />
1396 <param name="prefix">A <see cref="T:System.String" /> containing the URI that the derived type services. Can specify a scheme or a complete URI.</param>
1397 <param name="creator">An instance of a type that implements the <see cref="T:System.Net.IWebRequestCreate" /> interface.</param>
1399 <para> Registers a type derived from <see cref="T:System.Net.WebRequest" />, and associates the
1400 type with the specified URI.</para>
1404 <see langword="true " /> if registration is successful;
1405 <see langword="false" />, if
1406 <paramref name="prefix" />
1407 is already registered.</para>
1411 <see cref="T:System.Net.HttpWebRequest" /> is registered
1412 to service requests for HTTP and HTTPS schemes. Attempts to register a different
1413 type for these schemes will
1415 <block subset="none" type="note">
1416 <para>This method registers types that derive from <see cref="T:System.Net.WebRequest" />
1417 to service requests. These derived types are
1418 typically registered to handle a specific protocol, such HTTP or FTP, but can be
1419 registered to handle a request to a specific server or path on a server.
1420 Therefore, <paramref name="prefix" />
1421 can be either a scheme or a complete
1423 <para>The <see cref="T:System.Net.WebRequest" /> class calls the <see cref="M:System.Net.IWebRequestCreate.Create(System.Uri)" />
1424 method to create additional instances of the same type as
1425 <paramref name="creator" />.</para>
1428 <exception cref="T:System.ArgumentNullException">
1430 <paramref name="prefix" /> is <see langword="null" /> or
1431 <paramref name="creator" /> is <see langword="null" />.</para>
1434 <para>The following example demonstrates how to register a new
1436 <code lang="C#">using System;
1439 public class ftpWebRequest : WebRequest {
1440 //implement ftp-specific protocol methods and properties
1443 public class ftpCreator : IWebRequestCreate
1445 public WebRequest Create(Uri uri)
1447 return new ftpWebRequest();
1451 public class RegisterPrefixExample
1454 public static void Main()
1457 ftpCreator creator = new ftpCreator();
1458 WebRequest.RegisterPrefix("ftp://", creator);
1459 WebRequest wr = WebRequest.Create("ftp://testFile");
1460 Console.WriteLine(wr);
1464 <para>The output is</para>
1465 <para>ftpWebRequest</para>
1468 <Excluded>0</Excluded>
1470 <Member MemberName="RequestUri">
1471 <MemberSignature Language="ILASM" Value=".property class System.Uri RequestUri { public hidebysig virtual specialname class System.Uri get_RequestUri() }" />
1472 <MemberSignature Language="C#" Value="public virtual Uri RequestUri { get; }" />
1473 <MemberSignature Language="ILAsm" Value=".property instance class System.Uri RequestUri" />
1474 <MemberType>Property</MemberType>
1476 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
1477 <AssemblyVersion>2.0.0.0</AssemblyVersion>
1478 <AssemblyVersion>4.0.0.0</AssemblyVersion>
1481 <ReturnType>System.Uri</ReturnType>
1486 <para> Gets the <see cref="T:System.Uri" />
1487 of the resource associated with the
1488 current instance.</para>
1491 <para> A <see cref="T:System.Uri" /> containing the URI
1493 the resource associated with the current instance</para>
1496 <para>This property is read-only.</para>
1498 <block subset="none" type="behaviors">
1499 <see cref="P:System.Net.WebRequest.RequestUri" /> is required to
1500 contain the URI passed to
1501 the <see cref="M:System.Net.WebRequest.Create(System.Uri,System.Boolean)" />
1502 methods. If the protocol implemented
1503 by a derived class supports redirection, the derived class is required
1504 to provide a property to contain the URI that actually services the request.</block>
1507 <block subset="none" type="default">This property
1508 throws a <see cref="T:System.NotSupportedException" />
1512 <block subset="none" type="overrides">This property
1513 must be overridden by classes that inherit from <see cref="T:System.Net.WebRequest" /> to
1514 provide this functionality. </block>]</para>
1516 <block subset="none" type="usage">Use this property
1517 to determine the URI that the request was addressed to. For information about
1518 the URI that actually serviced the request, see <see cref="P:System.Net.WebResponse.ResponseUri" />
1522 <exception cref="T:System.NotSupportedException">This property is not implemented in the derived class. </exception>
1524 <Excluded>0</Excluded>
1526 <Member MemberName="System.Runtime.Serialization.ISerializable.GetObjectData">
1527 <MemberSignature Language="C#" Value="void ISerializable.GetObjectData (System.Runtime.Serialization.SerializationInfo serializationInfo, System.Runtime.Serialization.StreamingContext streamingContext);" />
1528 <MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void System.Runtime.Serialization.ISerializable.GetObjectData(class System.Runtime.Serialization.SerializationInfo serializationInfo, valuetype System.Runtime.Serialization.StreamingContext streamingContext) cil managed" />
1529 <MemberType>Method</MemberType>
1531 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
1532 <AssemblyVersion>2.0.0.0</AssemblyVersion>
1533 <AssemblyVersion>4.0.0.0</AssemblyVersion>
1536 <ReturnType>System.Void</ReturnType>
1539 <Parameter Name="serializationInfo" Type="System.Runtime.Serialization.SerializationInfo" />
1540 <Parameter Name="streamingContext" Type="System.Runtime.Serialization.StreamingContext" />
1543 <param name="serializationInfo">To be added.</param>
1544 <param name="streamingContext">To be added.</param>
1545 <summary>To be added.</summary>
1546 <remarks>To be added.</remarks>
1549 <Member MemberName="Timeout">
1550 <MemberSignature Language="ILASM" Value=".property int32 Timeout { public hidebysig virtual specialname int32 get_Timeout() public hidebysig virtual specialname void set_Timeout(int32 value) }" />
1551 <MemberSignature Language="C#" Value="public virtual int Timeout { get; set; }" />
1552 <MemberSignature Language="ILAsm" Value=".property instance int32 Timeout" />
1553 <MemberType>Property</MemberType>
1555 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
1556 <AssemblyVersion>2.0.0.0</AssemblyVersion>
1557 <AssemblyVersion>4.0.0.0</AssemblyVersion>
1560 <ReturnType>System.Int32</ReturnType>
1565 <para> Gets or sets the length of time before requests for resources time out.</para>
1568 <para> A <see cref="T:System.Int32" /> containing the length of time, in milliseconds, before the current request
1569 will time out, or <see cref="F:System.Threading.Timeout.Infinite" qualify="true" /> to indicate that the request does not time out.</para>
1573 <block subset="none" type="behaviors">Classes that
1574 derive from <see cref="T:System.Net.WebRequest" /> are required to indicate a timeout by throwing a <see cref="T:System.Net.WebException" /> with
1575 the <see cref="P:System.Net.WebException.Status" /> field set to <see cref="F:System.Net.WebExceptionStatus.Timeout" qualify="true" /> if a request times out.</block>
1578 <block subset="none" type="default">This
1579 property throws a <see cref="T:System.NotSupportedException" />
1583 <block subset="none" type="overrides">This property
1584 must be overridden by classes that inherit from <see cref="T:System.Net.WebRequest" /> to
1585 provide this functionality. </block>
1587 <block subset="none" type="usage">
1588 <para>Use this property to set the timeout period for requests for resources.</para>
1589 <para>The <see cref="P:System.Net.WebRequest.Timeout" /> property affects only synchronous
1590 requests made with the <see cref="M:System.Net.WebRequest.GetResponse" /> method. To time out asynchronous
1591 requests, use the <see cref="M:System.Net.WebRequest.Abort" /> method.</para>
1594 <exception cref="T:System.NotSupportedException">This property is not implemented in the derived class. </exception>
1596 <Excluded>0</Excluded>
1598 <Member MemberName="UseDefaultCredentials">
1599 <MemberSignature Language="C#" Value="public virtual bool UseDefaultCredentials { get; set; }" />
1600 <MemberSignature Language="ILAsm" Value=".property instance bool UseDefaultCredentials" />
1601 <MemberType>Property</MemberType>
1603 <AssemblyVersion>2.0.0.0</AssemblyVersion>
1604 <AssemblyVersion>4.0.0.0</AssemblyVersion>
1607 <ReturnType>System.Boolean</ReturnType>
1610 <summary>To be added.</summary>
1611 <value>To be added.</value>
1612 <remarks>To be added.</remarks>
1616 <TypeExcluded>0</TypeExcluded>