<TypeSignatureLanguage="ILASM"Value=".class public abstract serializable WebRequest extends System.MarshalByRefObject"/>
<TypeSignatureLanguage="C#"Value="public abstract class WebRequest : MarshalByRefObject, System.Runtime.Serialization.ISerializable"/>
<TypeSignatureLanguage="ILAsm"Value=".class public auto ansi abstract serializable WebRequest extends System.MarshalByRefObject implements class System.Runtime.Serialization.ISerializable"/>
<ThreadingSafetyStatement>All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.</ThreadingSafetyStatement>
<seecref="T:System.Net.WebRequest"/> is the abstract base class for the .NET Framework's request/response model for accessing data from the Internet. An application that uses the request/response model can request data from the Internet in a protocol-agnostic manner, in which the application works with instances of the <seecref="T:System.Net.WebRequest"/> class while protocol-specific descendant classes carry out the details of the request.</para>
<para>Requests are sent from an application to a particular URI, such as a Web page on a server. The URI determines the proper descendant class to create from a list of <seecref="T:System.Net.WebRequest"/> descendants registered for the application. <seecref="T:System.Net.WebRequest"/> descendants are typically registered to handle a specific protocol, such as HTTP or FTP, but can be registered to handle a request to a specific server or path on a server.</para>
<para>The <seecref="T:System.Net.WebRequest"/> class throws a <seecref="T:System.Net.WebException"/> when errors occur while accessing an Internet resource. The <seecref="P:System.Net.WebException.Status"/> property is one of the <seecref="T:System.Net.WebExceptionStatus"/> values that indicates the source of the error. When <seecref="P:System.Net.WebException.Status"/> is <seecref="F:System.Net.WebExceptionStatus.ProtocolError"/>, the <seecref="P:System.Net.WebException.Response"/> property contains the <seecref="T:System.Net.WebResponse"/> received from the Internet resource.</para>
<para>Because the <seecref="T:System.Net.WebRequest"/> class is an abstract class, the actual behavior of <seecref="T:System.Net.WebRequest"/> instances at run time is determined by the descendant class returned by <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method. For more information about default values and exceptions, see the documentation for the descendant classes, such as <seecref="T:System.Net.HttpWebRequest"/> and <seecref="T:System.Net.FileWebRequest"/>.</para>
<blocksubset="none"type="note">
<para>Use the <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method to initialize new <seecref="T:System.Net.WebRequest"/> instances. Do not use the <seecref="T:System.Net.WebRequest"/> constructor.</para>
</block>
<blocksubset="none"type="note">
<para>If the application that creates the WebRequest object runs with the credentials of a Normal user, the application will not be able to access certificates installed in the local machine store unless permission has been explicitly given to the user to do so.</para>
<para>Use the <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method to initialize new <seecref="T:System.Net.WebRequest"/> instances. Do not use the constructor.</para>
<para>When implemented by a descendant class, this constructor implements the <seecref="T:System.Runtime.Serialization.ISerializable"/> interface for the <seecref="T:System.Net.WebRequest"/> descendant.</para>
<para>Notice that an application must run in full trust mode when using serialization.</para>
<para>Initializes a new instance of the <seecref="T:System.Net.WebRequest"/> class from the specified instances of the <seecref="T:System.Runtime.Serialization.SerializationInfo"/> and <seecref="T:System.Runtime.Serialization.StreamingContext"/> classes.</para>
</summary>
<paramname="serializationInfo">
<attributionlicense="cc4"from="Microsoft"modified="false"/>A <seecref="T:System.Runtime.Serialization.SerializationInfo"/> that contains the information required to serialize the new <seecref="T:System.Net.WebRequest"/> instance. </param>
<paramname="streamingContext">
<attributionlicense="cc4"from="Microsoft"modified="false"/>A <seecref="T:System.Runtime.Serialization.StreamingContext"/> that indicates the source of the serialized stream associated with the new <seecref="T:System.Net.WebRequest"/> instance. </param>
</Docs>
</Member>
<MemberMemberName="Abort">
<MemberSignatureLanguage="ILASM"Value=".method public hidebysig virtual void Abort()"/>
<para>The <seecref="M:System.Net.WebRequest.Abort"/> method cancels asynchronous requests to Internet resources started with the <seecref="M:System.Net.WebRequest.BeginGetResponse(System.AsyncCallback,System.Object)"/> method.</para>
<blocksubset="none"type="note">
<para>The <seecref="T:System.Net.WebRequest"/> class is an abstract class. The actual behavior of <seecref="T:System.Net.WebRequest"/> instances at run time is determined by the descendant class returned by the <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method. For more information about default values and exceptions, see the documentation for the descendant classes, such as <seecref="T:System.Net.HttpWebRequest"/> and <seecref="T:System.Net.FileWebRequest"/>.</para>
<para>The <seecref="M:System.Net.WebRequest.BeginGetRequestStream(System.AsyncCallback,System.Object)"/> method starts an asynchronous request for a stream used to send data to an Internet resource. The callback method that implements the <seecref="T:System.AsyncCallback"/> delegate uses the <seecref="M:System.Net.WebRequest.EndGetRequestStream(System.IAsyncResult)"/> method to return the request stream.</para>
<blocksubset="none"type="note">
<para>The <seecref="T:System.Net.WebRequest"/> class is an abstract class. The actual behavior of <seecref="T:System.Net.WebRequest"/> instances at run time is determined by the descendant class returned by the <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method. For more information about default values and exceptions, see the documentation for the descendant classes, such as <seecref="T:System.Net.HttpWebRequest"/> and <seecref="T:System.Net.FileWebRequest"/>.</para>
<para>When overridden in a descendant class, provides an asynchronous version of the <seecref="M:System.Net.WebRequest.GetRequestStream"/> method.</para>
<para>The <seecref="M:System.Net.WebRequest.BeginGetResponse(System.AsyncCallback,System.Object)"/> method starts an asynchronous request for a response. The callback method that implements the <seecref="T:System.AsyncCallback"/> delegate uses the <seecref="M:System.Net.WebRequest.EndGetResponse(System.IAsyncResult)"/> method to return the <seecref="T:System.Net.WebResponse"/> from the Internet resource.</para>
<blocksubset="none"type="note">
<para>The <seecref="T:System.Net.WebRequest"/> class is an abstract class. The actual behavior of <seecref="T:System.Net.WebRequest"/> instances at run time is determined by the descendant class returned by the <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method. For more information about default values and exceptions, see the documentation for the descendant classes, such as <seecref="T:System.Net.HttpWebRequest"/> and <seecref="T:System.Net.FileWebRequest"/>.</para>
</block>
<blocksubset="none"type="note">
<para>If a WebException is thrown, use the <seecref="P:System.Net.WebException.Response"/> and <seecref="P:System.Net.WebException.Status"/> properties of the exception to determine the response from the server.</para>
<para>The current cache policy and the presence of the requested resource in the cache determine whether a response can be retrieved from the cache. Using cached responses usually improves application performance, but there is a risk that the response in the cache does not match the response on the server. </para>
<para>Default cache policy can be specified in the Machine.config configuration file or by setting the <seecref="P:System.Net.HttpWebRequest.DefaultCachePolicy"/> property for requests that use the Hypertext Transfer Protocol (HTTP) or Secure Hypertext Transfer Protocol (HTTPS) URI scheme.</para>
<para>A copy of a resource is only added to the cache if the response stream for the resource is retrieved and read to the end of the stream. So another request for the same resource could use a cached copy, depending on the cache policy level for this request.</para>
<para>The <seecref="P:System.Net.WebRequest.ConnectionGroupName"/> property associates specific requests within an application to one or more connection pools.</para>
<blocksubset="none"type="note">
<para>The <seecref="T:System.Net.WebRequest"/> class is an abstract class. The actual behavior of <seecref="T:System.Net.WebRequest"/> instances at run time is determined by the descendant class returned by the <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method. For more information about default values and exceptions, see the documentation for the descendant classes, such as <seecref="T:System.Net.HttpWebRequest"/> and <seecref="T:System.Net.FileWebRequest"/>.</para>
<para>The <seecref="P:System.Net.WebRequest.ContentLength"/> property contains the number of bytes of data sent to the Internet resource by the <seecref="T:System.Net.WebRequest"/> instance.</para>
<blocksubset="none"type="note">
<para>The <seecref="T:System.Net.WebRequest"/> class is an abstract class. The actual behavior of <seecref="T:System.Net.WebRequest"/> instances at run time is determined by the descendant class returned by the <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method. For more information about default values and exceptions, see the documentation for the descendant classes, such as <seecref="T:System.Net.HttpWebRequest"/> and <seecref="T:System.Net.FileWebRequest"/>.</para>
<para>The <seecref="P:System.Net.WebRequest.ContentType"/> property contains the media type of the request. This is typically the MIME encoding of the content.</para>
<blocksubset="none"type="note">
<para>The <seecref="T:System.Net.WebRequest"/> class is an abstract class. The actual behavior of <seecref="T:System.Net.WebRequest"/> instances at run time is determined by the descendant class returned by the <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method. For more information about default values and exceptions, see the documentation for the descendant classes, such as <seecref="T:System.Net.HttpWebRequest"/> and <seecref="T:System.Net.FileWebRequest"/>.</para>
<exceptioncref="T:System.NotSupportedException">The request scheme specified in <paramrefname="requestUri "/> is not registered.</exception>
<exceptioncref="T:System.UriFormatException">The URI specified in <paramrefname="requestUriString"/> is not a valid URI.</exception>
<exceptioncref="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>
<permissioncref="!:System.Security.Permissions.WebPermission">Requires permission to connect to the requested URI. See <seecref="F:System.Net.NetworkAccess.Connect"/>.</permission>
<para>The <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method returns a descendant of the <seecref="T:System.Net.WebRequest"/> class determined at run time as the closest registered match for <paramrefname="requestUri"/>.</para>
<para>For example, when a URI beginning with http:// or https:// is passed in <paramrefname="requestUri"/>, an <seecref="T:System.Net.HttpWebRequest"/> is returned by <seecref="M:System.Net.WebRequest.Create(System.Uri)"/>. If a URI beginning with ftp:// is passed instead, the <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method will return a <seecref="T:System.Net.FileWebRequest"/> instance. If a URI beginning with file:// is passed instead, the <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method will return a <seecref="T:System.Net.FileWebRequest"/> instance.</para>
<para>The pre-registered reserve types already registered include the following:</para>
<listtype="bullet">
<item>
<para>http://</para>
</item>
<item>
<para>https://</para>
</item>
<item>
<para>ftp://</para>
</item>
<item>
<para>file://</para>
</item>
</list>
<para>The .NET Framework includes support for the http://, https://, ftp://, and file:// URI schemes. Custom <seecref="T:System.Net.WebRequest"/> descendants to handle other requests are registered with the <seecref="M:System.Net.WebRequest.RegisterPrefix(System.String,System.Net.IWebRequestCreate)"/> method.</para>
<para>The <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method uses the <paramrefname="requestUriString"/> parameter to create a <seecref="T:System.Uri"/> instance that it passes to the new <seecref="T:System.Net.WebRequest"/>.</para>
<blocksubset="none"type="note">
<para>This member outputs trace information when you enable network tracing in your application. For more information, see <formattype="text/html"><ahref="E993B7C3-087F-45D8-9C02-9DDED936D804">[<topic://conUsingNetworkTracing>]</a></format>.</para>
<exceptioncref="T:System.NotSupportedException">The request scheme specified in <paramrefname="requestUri "/> is not registered.</exception>
<exceptioncref="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>
<permissioncref="!:System.Security.Permissions.WebPermission">Requires permission to connect to the requested URI. See <seecref="F:System.Net.NetworkAccess.Connect"/>.</permission>
<para>The <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method returns a descendant of the <seecref="T:System.Net.WebRequest"/> class determined at run time as the closest registered match for <paramrefname="requestUri"/>.</para>
<para>For example, if you create a <seecref="T:System.Net.WebRequest"/> descendant, Handler1, to handle requests to http://www.contoso.com/text/ and another named Handler2 to handle requests to http://www.contoso.com/code/, you can use <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method to return the WebRequest descendant associated with either specified URI.</para>
<para>To return a descendant of the <seecref="T:System.Net.WebRequest"/> class based on only the scheme portion of a URI, use the <seecref="M:System.Net.WebRequest.CreateDefault(System.Uri)"/> method.</para>
<para>For example, when a URI beginning with http:// or https:// is passed in <paramrefname="requestUri"/>, an <seecref="T:System.Net.HttpWebRequest"/> is returned by <seecref="M:System.Net.WebRequest.Create(System.Uri)"/>. If a URI beginning with ftp:// is passed instead, the <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method will return a <seecref="T:System.Net.FileWebRequest"/> instance. If a URI beginning with file:// is passed instead, the <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method will return a <seecref="T:System.Net.FileWebRequest"/> instance.</para>
<para>The pre-registered reserve types already registered include the following:</para>
<listtype="bullet">
<item>
<para>http://</para>
</item>
<item>
<para>https://</para>
</item>
<item>
<para>ftp://</para>
</item>
<item>
<para>file://</para>
</item>
</list>
<para>The .NET Framework includes support for the http://, https://, ftp://, and file:// URI schemes. Custom <seecref="T:System.Net.WebRequest"/> descendants to handle other requests are registered with the <seecref="M:System.Net.WebRequest.RegisterPrefix(System.String,System.Net.IWebRequestCreate)"/> method.</para>
<blocksubset="none"type="note">
<para>This member outputs trace information when you enable network tracing in your application. For more information, see <formattype="text/html"><ahref="E993B7C3-087F-45D8-9C02-9DDED936D804">[<topic://conUsingNetworkTracing>]</a></format>.</para>
<MemberSignatureLanguage="ILAsm"Value=".method public static hidebysig class System.Net.WebRequest CreateDefault(class System.Uri requestUri) cil managed"/>
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Net.WebRequest</ReturnType>
</ReturnValue>
<Parameters>
<ParameterName="requestUri"Type="System.Uri"/>
</Parameters>
<Docs>
<exceptioncref="T:System.ArgumentNullException">
<paramrefname="requestUri"/> is <seelangword="null"/>.</exception>
<exceptioncref="T:System.NotSupportedException">The request scheme specified in <paramrefname="requestUri "/> is not registered.</exception>
<exceptioncref="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>
<permissioncref="!:System.Security.Permissions.WebPermission">Requires permission to connect to the requested URI. See <seecref="F:System.Net.NetworkAccess.Connect"/>.</permission>
<example>
<para>This example demonstrates the use of the <seecref="M:System.Net.WebRequest.Create(System.Uri,System.Boolean)"/> and <seecref="M:System.Net.WebRequest.CreateDefault(System.Uri)"/> methods.</para>
<codelang="C#">using System;
using System.Net;
public class ContosoTextRequest : WebRequest, IWebRequestCreate
{
public new WebRequest Create(Uri uri)
{
return new ContosoTextRequest();
}
}
public class CreateDefaultExample
{
public static void Main()
{
ContosoTextRequest contoso = new ContosoTextRequest();
Uri contosoUri = new Uri("http://www.contoso.com/text");
<para>The <seecref="M:System.Net.WebRequest.CreateDefault(System.Uri)"/> method returns a <seecref="T:System.Net.WebRequest"/> descendant instance based on only the scheme portion of a URI.</para>
<para>For example, when a URI beginning with http:// is passed in <paramrefname="requestUri"/>, an <seecref="T:System.Net.HttpWebRequest"/> is returned by <seecref="M:System.Net.WebRequest.CreateDefault(System.Uri)"/>. If a URI beginning with file:// is passed instead, the <seecref="M:System.Net.WebRequest.CreateDefault(System.Uri)"/> method will return a <seecref="T:System.Net.FileWebRequest"/>.</para>
<blocksubset="none"type="note">
<para>This member outputs trace information when you enable network tracing in your application. For more information, see <formattype="text/html"><ahref="E993B7C3-087F-45D8-9C02-9DDED936D804">[<topic://conUsingNetworkTracing>]</a></format>.</para>
<MemberSignatureLanguage="ILAsm"Value=".method public static hidebysig class System.Net.HttpWebRequest CreateHttp(string requestUriString) cil managed"/>
<para>The <seecref="M:System.Net.WebRequest.CreateHttp(System.String)"/> method returns an instance of the <seecref="T:System.Net.HttpWebRequest"/> class for the <paramrefname="requestUriString"/>.</para>
<para>When a URI that begins with http:// or http:// is passed in the <paramrefname="requestUriString"/> parameter, a <seecref="T:System.Net.HttpWebRequest"/> is returned by <seecref="M:System.Net.WebRequest.CreateHttp(System.String)"/>. Another other scheme will throw an <seecref="T:System.NotSupportedException"/>. </para>
<para>The <seecref="M:System.Net.WebRequest.CreateHttp(System.String)"/> method uses the <paramrefname="requestUriString"/> parameter to create a <seecref="T:System.Uri"/> instance that it passes to the new <seecref="T:System.Net.HttpWebRequest"/>. If the method is successful, the <seecref="P:System.Net.HttpWebRequest.AllowReadStreamBuffering"/> property on the returned <seecref="T:System.Net.HttpWebRequest"/> instance is set to false.</para>
<para>The .NET Framework includes support for the http:// and https:// URI schemes. Custom <seecref="T:System.Net.WebRequest"/> descendants to handle other requests are registered with the <seecref="M:System.Net.WebRequest.RegisterPrefix(System.String,System.Net.IWebRequestCreate)"/> method. The <seecref="M:System.Net.WebRequest.Create(System.String)"/> method can be used to create a descendant of the <seecref="T:System.Net.WebRequest"/> class for other schemes.</para>
<para>The <seecref="M:System.Net.WebRequest.CreateHttp(System.Uri)"/> method returns an instance of the <seecref="T:System.Net.HttpWebRequest"/> class for the <paramrefname="requestUri"/>.</para>
<para>When a URI that begins with http:// or http:// is passed in the <paramrefname="requestUri"/> parameter, an <seecref="T:System.Net.HttpWebRequest"/> is returned by <seecref="M:System.Net.WebRequest.CreateHttp(System.Uri)"/>. Another other scheme will throw a <seecref="T:System.NotSupportedException"/>. </para>
<para>The <seecref="M:System.Net.WebRequest.CreateHttp(System.Uri)"/> method uses the <paramrefname="requestUri"/> parameter to create a new <seecref="T:System.Net.HttpWebRequest"/> instance. If the method is successful, the <seecref="P:System.Net.HttpWebRequest.AllowReadStreamBuffering"/> property on the returned <seecref="T:System.Net.HttpWebRequest"/> instance is set to false.</para>
<para>The .NET Framework includes support for the http:// and https:// URI schemes. Custom <seecref="T:System.Net.WebRequest"/> descendants to handle other requests are registered with the <seecref="M:System.Net.WebRequest.RegisterPrefix(System.String,System.Net.IWebRequestCreate)"/> method. The <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method can be used to create a descendant of the <seecref="T:System.Net.WebRequest"/> class for other schemes.</para>
<para>The <seecref="P:System.Net.WebRequest.Credentials"/> property contains the authentication credentials required to access the Internet resource.</para>
<blocksubset="none"type="note">
<para>The <seecref="T:System.Net.WebRequest"/> class is an abstract class. The actual behavior of <seecref="T:System.Net.WebRequest"/> instances at run time is determined by the descendant class returned by the <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method. For more information about default values and exceptions, see the documentation for the descendant classes, such as <seecref="T:System.Net.HttpWebRequest"/> and <seecref="T:System.Net.FileWebRequest"/>.</para>
<para>When overridden in a descendant class, gets or sets the network credentials used for authenticating the request with the Internet resource.</para>
<para>This policy is used for this request if the following conditions exist:</para>
<listtype="bullet">
<item>
<para>There is no <seecref="P:System.Net.HttpWebRequest.DefaultCachePolicy"/> property specified for this request.</para>
</item>
<item>
<para>The machine and application configuration files do not specify a cache policy that is applicable to the Uniform Resource Identifier (URI) used to create this request.</para>
</item>
</list>
<para>The cache policy determines whether the requested resource can be taken from a cache instead of sending the request to the resource host computer.</para>
<para>A copy of a resource is only added to the cache if the response stream for the resource is retrieved and read to the end of the stream. So another request for the same resource could use a cached copy, depending on the cache policy level for this request.</para>
<para>The <seecref="P:System.Net.WebRequest.DefaultWebProxy"/> property gets or sets the global proxy. The <seecref="P:System.Net.WebRequest.DefaultWebProxy"/> property determines the default proxy that all <seecref="T:System.Net.WebRequest"/> instances use if the request supports proxies and no proxy is set explicitly using the <seecref="P:System.Net.HttpWebRequest.Proxy"/> property. Proxies are currently supported by <seecref="T:System.Net.FtpWebRequest"/> and <seecref="T:System.Net.HttpWebRequest"/>.</para>
<para>The <seecref="P:System.Net.WebRequest.DefaultWebProxy"/> property reads proxy settings from the app.config file. If there is no config file, the current user's Internet Explorer (IE) proxy settings are used.</para>
<para>If the <seecref="P:System.Net.WebRequest.DefaultWebProxy"/> property is set to null, all subsequent instances of the <seecref="T:System.Net.WebRequest"/> class created by the <seecref="M:System.Net.WebRequest.Create(System.String)"/> or <seecref="M:System.Net.WebRequest.CreateDefault(System.Uri)"/> methods do not have a proxy.</para>
<MemberSignatureLanguage="ILASM"Value=".method public hidebysig virtual class System.IO.Stream EndGetRequestStream(class System.IAsyncResult asyncResult)"/>
<exceptioncref="T:System.NotSupportedException">This method is not overridden in the derived class.</exception>
<exceptioncref="T:System.ArgumentException">
<paramrefname="asyncResult"/> was not returned by a call to <seecref="M:System.Net.WebRequest.BeginGetRequestStream(System.AsyncCallback,System.Object)"/>.</exception>
<exceptioncref="T:System.ArgumentNullException">
<paramrefname="asyncResult"/> is a null reference. </exception>
<para>The <seecref="M:System.Net.WebRequest.EndGetRequestStream(System.IAsyncResult)"/> method completes an asynchronous stream request that was started by the <seecref="M:System.Net.WebRequest.BeginGetRequestStream(System.AsyncCallback,System.Object)"/> method.</para>
<blocksubset="none"type="note">
<para>To avoid timing issues with garbage collection, be sure to close the response stream by calling the <seecref="M:System.IO.Stream.Close"/> method on the stream returned by <seecref="M:System.Net.WebResponse.GetResponseStream"/> after calling <seecref="M:System.Net.WebRequest.EndGetResponse(System.IAsyncResult)"/>.</para>
</block>
<blocksubset="none"type="note">
<para>The <seecref="T:System.Net.WebRequest"/> class is an abstract class. The actual behavior of <seecref="T:System.Net.WebRequest"/> instances at run time is determined by the descendant class returned by the <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method. For more information about default values and exceptions, see the documentation for the descendant classes, such as <seecref="T:System.Net.HttpWebRequest"/> and <seecref="T:System.Net.FileWebRequest"/>.</para>
<para>A <seecref="T:System.IO.Stream"/> to write data to.</para>
</returns>
<paramname="asyncResult">
<attributionlicense="cc4"from="Microsoft"modified="false"/>An <seecref="T:System.IAsyncResult"/> that references a pending request for a stream. </param>
</Docs>
<Excluded>0</Excluded>
</Member>
<MemberMemberName="EndGetResponse">
<MemberSignatureLanguage="ILASM"Value=".method public hidebysig virtual class System.Net.WebResponse EndGetResponse(class System.IAsyncResult asyncResult)"/>
<exceptioncref="T:System.NotSupportedException">This method is not overridden in the derived class.</exception>
<exceptioncref="T:System.ArgumentException">
<paramrefname="asyncResult"/> was not returned by a call to <seecref="M:System.Net.WebRequest.BeginGetResponse(System.AsyncCallback,System.Object)"/>.</exception>
<exceptioncref="T:System.ArgumentNullException">
<paramrefname="asyncResult"/> is a null reference.</exception>
<para>The <seecref="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>
<para>-or-</para>
<para>This method was called previously using <paramrefname="asyncResult."/></para>
</exception>
<exceptioncref="T:System.Net.WebException">An error occurred while processing the request.</exception>
<para>The <seecref="M:System.Net.WebRequest.EndGetResponse(System.IAsyncResult)"/> method completes an asynchronous request for an Internet resource that was started with the <seecref="M:System.Net.WebRequest.BeginGetResponse(System.AsyncCallback,System.Object)"/> method.</para>
<blocksubset="none"type="note">
<para>The <seecref="T:System.Net.WebRequest"/> class is an abstract class. The actual behavior of <seecref="T:System.Net.WebRequest"/> instances at run time is determined by the descendant class returned by the <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method. For more information about default values and exceptions, see the documentation for the descendant classes, such as <seecref="T:System.Net.HttpWebRequest"/> and <seecref="T:System.Net.FileWebRequest"/>.</para>
<para>A <seecref="T:System.Net.WebResponse"/> that contains a response to the Internet request.</para>
</returns>
<paramname="asyncResult">
<attributionlicense="cc4"from="Microsoft"modified="false"/>An <seecref="T:System.IAsyncResult"/> that references a pending request for a response. </param>
<para>Any objects included in the <seecref="T:System.Runtime.Serialization.SerializationInfo"/> are automatically tracked and serialized by the formatter.</para>
<para>Populates a <seecref="T:System.Runtime.Serialization.SerializationInfo"/> with the data needed to serialize the target object.</para>
</summary>
<paramname="serializationInfo">
<attributionlicense="cc4"from="Microsoft"modified="false"/>The <seecref="T:System.Runtime.Serialization.SerializationInfo"/> to populate with data. </param>
<paramname="streamingContext">
<attributionlicense="cc4"from="Microsoft"modified="false"/>A <seecref="T:System.Runtime.Serialization.StreamingContext"/> that specifies the destination for this serialization.</param>
</Docs>
</Member>
<MemberMemberName="GetRequestStream">
<MemberSignatureLanguage="ILASM"Value=".method public hidebysig virtual class System.IO.Stream GetRequestStream()"/>
<para>The <seecref="M:System.Net.WebRequest.GetRequestStream"/> method initiates a request to send data to the Internet resource and returns a <seecref="T:System.IO.Stream"/> instance for sending data to the Internet resource.</para>
<para>The <seecref="M:System.Net.WebRequest.GetRequestStream"/> method provides synchronous access to the <seecref="T:System.IO.Stream"/>. For asynchronous access, use the <seecref="M:System.Net.WebRequest.BeginGetRequestStream(System.AsyncCallback,System.Object)"/> and <seecref="M:System.Net.WebRequest.EndGetRequestStream(System.IAsyncResult)"/> methods.</para>
<blocksubset="none"type="note">
<para>The <seecref="T:System.Net.WebRequest"/> class is an abstract class. The actual behavior of <seecref="T:System.Net.WebRequest"/> instances at run time is determined by the descendant class returned by the <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method. For more information about default values and exceptions, see the documentation for the descendant classes, such as <seecref="T:System.Net.HttpWebRequest"/> and <seecref="T:System.Net.FileWebRequest"/>.</para>
<para>This operation will not block. The returned <seecref="T:System.Threading.Tasks.Task`1"/>object will complete when the <seecref="T:System.IO.Stream"/> for writing data to the Internet resource is available.</para>
<para>When overridden in a descendant class, returns a <seecref="T:System.IO.Stream"/> for writing data to the Internet resource as an asynchronous operation.</para>
<para>The <seecref="M:System.Net.WebRequest.GetResponse"/> method sends a request to an Internet resource and returns a <seecref="T:System.Net.WebResponse"/> instance. If the request has already been initiated by a call to <seecref="M:System.Net.WebRequest.GetRequestStream"/>, the <seecref="M:System.Net.WebRequest.GetResponse"/> method completes the request and returns any response.</para>
<para>The <seecref="M:System.Net.WebRequest.GetResponse"/> method provides synchronous access to the <seecref="T:System.Net.WebResponse"/>. For asynchronous access, use the <seecref="M:System.Net.WebRequest.BeginGetResponse(System.AsyncCallback,System.Object)"/> and <seecref="M:System.Net.WebRequest.EndGetResponse(System.IAsyncResult)"/> methods.</para>
<blocksubset="none"type="note">
<para>The <seecref="T:System.Net.WebRequest"/> class is an abstract class. The actual behavior of <seecref="T:System.Net.WebRequest"/> instances at run time is determined by the descendant class returned by the <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method. For more information about default values and exceptions, see the documentation for the descendant classes, such as <seecref="T:System.Net.HttpWebRequest"/> and <seecref="T:System.Net.FileWebRequest"/>.</para>
</block>
<blocksubset="none"type="note">
<para>If a WebException is thrown, use the <seecref="P:System.Net.WebException.Response"/> and <seecref="P:System.Net.WebException.Status"/> properties of the exception to determine the response from the server.</para>
<para>This operation will not block. The returned <seecref="T:System.Threading.Tasks.Task`1"/> object will complete after a response to an Internet request is available.</para>
<para><seecref="M:System.Net.WebRequest.GetSystemWebProxy"/> creates an appropriate proxy object for the current user.</para>
<para>On Windows, the method reads the current user's Internet Explorer (IE) proxy settings. The settings supported on Mono are proxy enabled, proxy URL, and proxy excluded domains.</para>
<para>On UNIX-like systems (but not including Mac OS, iOS, or Android), the method reads the environment variables "MONO_PROXY" (or "mono_proxy") and "NO_PROXY" (or "no_proxy"). See the mono man page for more information.</para>
<para>If your application is impersonating several users, you can use the <seecref="M:System.Net.WebRequest.GetSystemWebProxy"/> method to retrieve a proxy for each impersonated user.</para>
<para>The <seecref="P:System.Net.WebRequest.Headers"/> property contains a <seecref="T:System.Net.WebHeaderCollection"/> instance containing the header information to send to the Internet resource.</para>
<blocksubset="none"type="note">
<para>The <seecref="T:System.Net.WebRequest"/> class is an abstract class. The actual behavior of <seecref="T:System.Net.WebRequest"/> instances at run time is determined by the descendant class returned by the <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method. For more information about default values and exceptions, see the documentation for the descendant classes, such as <seecref="T:System.Net.HttpWebRequest"/> and <seecref="T:System.Net.FileWebRequest"/>.</para>
<para>When overridden in a descendant class, the <seecref="P:System.Net.WebRequest.Method"/> property contains the request method to use in this request.</para>
<blocksubset="none"type="note">
<para>The <seecref="T:System.Net.WebRequest"/> class is an abstract class. The actual behavior of <seecref="T:System.Net.WebRequest"/> instances at run time is determined by the descendant class returned by the <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method. For more information about default values and exceptions, see the documentation for the descendant classes, such as <seecref="T:System.Net.HttpWebRequest"/> and <seecref="T:System.Net.FileWebRequest"/>.</para>
<para>With the exception of the first request, the <seecref="P:System.Net.WebRequest.PreAuthenticate"/> property indicates whether to send authentication information with subsequent requests without waiting to be challenged by the server. When <seecref="P:System.Net.WebRequest.PreAuthenticate"/> is false, the <seecref="T:System.Net.WebRequest"/> waits for an authentication challenge before sending authentication information.</para>
<blocksubset="none"type="note">
<para>The <seecref="T:System.Net.WebRequest"/> class is an abstract class. The actual behavior of <seecref="T:System.Net.WebRequest"/> instances at run time is determined by the descendant class returned by the <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method. For more information about default values and exceptions, see the documentation for the descendant classes, such as <seecref="T:System.Net.HttpWebRequest"/> and <seecref="T:System.Net.FileWebRequest"/>.</para>
<para>The <seecref="P:System.Net.WebRequest.Proxy"/> property identifies the network proxy that the request uses to access the Internet resource. The request is made through the proxy server rather than directly to the Internet resource.</para>
<blocksubset="none"type="note">
<para>The <seecref="T:System.Net.WebRequest"/> class is an abstract class. The actual behavior of <seecref="T:System.Net.WebRequest"/> instances at run time is determined by the descendant class returned by the <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method. For more information about default values and exceptions, see the documentation for the descendant classes, such as <seecref="T:System.Net.HttpWebRequest"/> and <seecref="T:System.Net.FileWebRequest"/>.</para>
<para>When overridden in a descendant class, gets or sets the network proxy to use to access this Internet resource.</para>
</summary>
</Docs>
<Excluded>0</Excluded>
</Member>
<MemberMemberName="RegisterPrefix">
<MemberSignatureLanguage="ILASM"Value=".method public hidebysig static bool RegisterPrefix(string prefix, class System.Net.IWebRequestCreate creator)"/>
<para>The <seecref="M:System.Net.WebRequest.RegisterPrefix(System.String,System.Net.IWebRequestCreate)"/> method registers <seecref="T:System.Net.WebRequest"/> descendants to service requests. <seecref="T:System.Net.WebRequest"/> descendants are typically registered to handle a specific protocol, such HTTP or FTP, but can be registered to handle a request to a specific server or path on a server.</para>
<para>The pre-registered reserve types already registered include the following:</para>
<listtype="bullet">
<item>
<para>http://</para>
</item>
<item>
<para>https://</para>
</item>
<item>
<para>ftp://</para>
</item>
<item>
<para>file://</para>
</item>
</list>
<para>For more information, see the <seecref="M:System.Net.WebRequest.Create(System.String)"/> and <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> methods.</para>
<para>Duplicate prefixes are not allowed. <seecref="M:System.Net.WebRequest.RegisterPrefix(System.String,System.Net.IWebRequestCreate)"/> returns false if an attempt is made to register a duplicate prefix.</para>
<blocksubset="none"type="note">
<para>The <seecref="T:System.Net.HttpWebRequest"/> class is registered to service requests for HTTP and HTTPS schemes by default. Attempts to register a different <seecref="T:System.Net.WebRequest"/> descendant for these schemes will fail.</para>
<para>true if registration is successful; otherwise, false.</para>
</returns>
<paramname="prefix">
<attributionlicense="cc4"from="Microsoft"modified="false"/>The complete URI or URI prefix that the <seecref="T:System.Net.WebRequest"/> descendant services. </param>
<paramname="creator">
<attributionlicense="cc4"from="Microsoft"modified="false"/>The create method that the <seecref="T:System.Net.WebRequest"/> calls to create the <seecref="T:System.Net.WebRequest"/> descendant. </param>
</Docs>
<Excluded>0</Excluded>
</Member>
<MemberMemberName="RequestUri">
<MemberSignatureLanguage="ILASM"Value=".property class System.Uri RequestUri { public hidebysig virtual specialname class System.Uri get_RequestUri() }"/>
<MemberSignatureLanguage="C#"Value="public virtual Uri RequestUri { get; }"/>
<MemberSignatureLanguage="ILAsm"Value=".property instance class System.Uri RequestUri"/>
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Uri</ReturnType>
</ReturnValue>
<Parameters/>
<Docs>
<value>
<para> A <seecref="T:System.Uri"/> containing the URI
of
the resource associated with the current instance</para>
</value>
<exceptioncref="T:System.NotSupportedException">This property is not implemented in the derived class. </exception>
<para>When overridden in a descendant class, the <seecref="P:System.Net.WebRequest.RequestUri"/> property contains the <seecref="T:System.Uri"/> instance that <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method uses to create the request.</para>
<blocksubset="none"type="note">
<para>The <seecref="T:System.Net.WebRequest"/> class is an abstract class. The actual behavior of <seecref="T:System.Net.WebRequest"/> instances at run time is determined by the descendant class returned by the <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method. For more information about default values and exceptions, see the documentation for the descendant classes, such as <seecref="T:System.Net.HttpWebRequest"/> and <seecref="T:System.Net.FileWebRequest"/>.</para>
<para>When overridden in a descendant class, populates a <seecref="T:System.Runtime.Serialization.SerializationInfo"/> instance with the data needed to serialize the <seecref="T:System.Net.WebRequest"/>.</para>
</summary>
<paramname="serializationInfo">
<attributionlicense="cc4"from="Microsoft"modified="false"/>A <seecref="T:System.Runtime.Serialization.SerializationInfo"/>, which holds the serialized data for the <seecref="T:System.Net.WebRequest"/>. </param>
<paramname="streamingContext">
<attributionlicense="cc4"from="Microsoft"modified="false"/>A <seecref="T:System.Runtime.Serialization.StreamingContext"/> that contains the destination of the serialized stream associated with the new <seecref="T:System.Net.WebRequest"/>. </param>
</Docs>
</Member>
<MemberMemberName="Timeout">
<MemberSignatureLanguage="ILASM"Value=".property int32 Timeout { public hidebysig virtual specialname int32 get_Timeout() public hidebysig virtual specialname void set_Timeout(int32 value) }"/>
<MemberSignatureLanguage="C#"Value="public virtual int Timeout { get; set; }"/>
<para>The <seecref="P:System.Net.WebRequest.Timeout"/> property indicates the length of time, in milliseconds, until the request times out and throws a <seecref="T:System.Net.WebException"/>. The <seecref="P:System.Net.WebRequest.Timeout"/> property affects only synchronous requests made with the <seecref="M:System.Net.WebRequest.GetResponse"/> method. To time out asynchronous requests, use the <seecref="M:System.Net.WebRequest.Abort"/> method.</para>
<blocksubset="none"type="note">
<para>The <seecref="T:System.Net.WebRequest"/> class is an abstract class. The actual behavior of <seecref="T:System.Net.WebRequest"/> instances at run time is determined by the descendant class returned by the <seecref="M:System.Net.WebRequest.Create(System.Uri)"/> method. For more information about default values and exceptions, see the documentation for the descendant classes, such as <seecref="T:System.Net.HttpWebRequest"/> and <seecref="T:System.Net.FileWebRequest"/>.</para>
<para>Set this property to true when requests made by this <seecref="T:System.Net.WebRequest"/> object should, if requested by the server, be authenticated using the credentials of the currently logged on user. For client applications, this is the desired behavior in most scenarios. For middle tier applications, such as ASP.NET applications, instead of using this property, you would typically set the <seecref="P:System.Net.WebRequest.Credentials"/> property to the credentials of the client on whose behalf the request is made.</para>
<para>When overridden in a descendant class, gets or sets a <seecref="T:System.Boolean"/> value that controls whether <seecref="P:System.Net.CredentialCache.DefaultCredentials"/> are sent with requests.</para>