Mono Class Library: System.Net.WebRequest Overview | Members

System.Net.WebRequest.Create Method

Constructs a new instance of a class derived from System.Net.WebRequest. The new instance is of the type registered for the scheme of the specified URI.

public static WebRequest Create (string requestUriString)

Parameters

requestUriString
A string that contains a URI.

Returns

A new instance of a class that derived from System.Net.WebRequest and is registered to handle the scheme of requestUriString.

Permissions

TypeReason
!:System.Security.Permissions.WebPermissionRequires permission to connect to the requested URI. See NetworkAccess.Connect.

Exceptions

TypeReason
ArgumentNullExceptionrequestUriString is null.
NotSupportedExceptionThe request scheme specified in requestUri is not registered.
UriFormatExceptionThe URI specified in requestUriString is not a valid URI.
System.Security.SecurityExceptionThe caller does not have permission to connect to the requested URI or a URI that the request is redirected to.

Remarks

Note:

This method returns a new instance of a class that derived from System.Net.WebRequest . The Type of this new instance is determined at run time by the scheme of the URI in requestUriString. For example, when a URI beginning with http:// is passed in requestUriString, a System.Net.HttpWebRequest instance is returned.

Classes that derive from System.Net.WebRequest that are created to handle other requests are registered with the WebRequest.RegisterPrefix(string, IWebRequestCreate) method.

Requirements

Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0