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. [Edit]

public static WebRequest Create (string requestUriString)

Parameters

requestUriString
A string that contains a URI. [Edit]

Returns

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

Permissions

TypeReason
!:System.Security.Permissions.WebPermission [Edit] Requires permission to connect to the requested URI. See NetworkAccess.Connect.

Exceptions

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

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.

[Edit]

Requirements

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