Share via


Create Method (String)

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Initializes a new WebRequest instance for the specified URI scheme.

Namespace:  System.Net
Assembly:  System.Http (in System.Http.dll)

Syntax

'Declaration
Public Shared Function Create ( _
    requestUriString As String _
) As WebRequest
public static WebRequest Create(
    string requestUriString
)
public:
static WebRequest^ Create(
    String^ requestUriString
)
static member Create : 
        requestUriString:string -> WebRequest 
public static function Create(
    requestUriString : String
) : WebRequest

Parameters

Return Value

Type: System.Net. . :: . .WebRequest
A WebRequest descendant for the specific URI scheme.

Remarks

The Create method returns a descendant of the WebRequest class determined at run time as the closest registered match for requestUri.

For example, when a URI beginning with http:// or https:// is passed in requestUri, an HttpWebRequest is returned by Create. If a URI beginning with ftp:// is passed instead, the Create method will return a FileWebRequest instance. If a URI beginning with file:// is passed instead, the Create method will return a FileWebRequest instance.

The pre-registered reserve types already registered include the following:

  • http://

  • https://

  • ftp://

  • file://

The Create method uses the requestUriString parameter to create a Uri instance that it passes to the new WebRequest.

.NET Framework Security

See Also

Reference

WebRequest Class

Create Overload

System.Net Namespace