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.

public static WebRequest Create (Uri requestUri)

Parameters

requestUri
A Uri containing the URI of the requested resource.

Returns

A new instance of a class derived from System.Net.WebRequest that is registered to handle the closest registered match for requestUri.

Permissions

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

Exceptions

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

Remarks

To determine the closest match, this method checks the registered URIs for the longest URI prefix that matches requestUri.

Note:

For an example that demonstrates this method, see WebRequest.CreateDefault(Uri).

Requirements

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