Create Method (Uri)
Collapse the table of content
Expand the table of content

WebRequest.Create Method (Uri)

[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]

Initializes a new WebRequest instance for the specified URI scheme.

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

public static WebRequest Create(
	Uri requestUri


Type: System.Uri
A Uri containing the URI of the requested resource.

Return Value

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


The request scheme specified in requestUri has not been registered.


requestUri is null.


The caller does not have permission to connect to the requested URI or a URI that the request is redirected to.

The Create(Uri) method returns a descendant of the WebRequest class determined at run time as the closest registered match for requestUri. By default, The Create method returns a derived instance of the HttpWebRequest class.

For example, if you create a WebRequest descendant, Handler1, to handle requests to and another named Handler2 to handle requests to, you can use Create method to return the WebRequest descendant associated with either specified URI.

The .NET Framework in Windows Phone includes support for the http:// and https:// URI schemes. Custom WebRequest descendants to handle other requests are registered with the RegisterPrefix method.

Version Notes

Windows Phone

If you attempt to access a file from an FTP site, the application throws NullRefrenceException instead of NotSupportedException.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

© 2017 Microsoft