Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 1.1
.NET Framework
Reference
Class Library
System.Net
WebRequest Class
Methods
 CreateDefault Method
This page is specific to
Microsoft Visual Studio 2003/.NET Framework 1.1

Other versions are also available for the following:
.NET Framework Class Library
WebRequest.CreateDefault Method

Initializes a new WebRequest instance for the specified URI scheme.

[Visual Basic]
Public Shared Function CreateDefault( _
   ByVal requestUri As Uri _
) As WebRequest
[C#]
public static WebRequest CreateDefault(
 Uri requestUri
);
[C++]
public: static WebRequest* CreateDefault(
 Uri* requestUri
);
[JScript]
public static function CreateDefault(
   requestUri : Uri
) : WebRequest;

Parameters

requestUri
A Uri containing the URI of the requested resource.

Return Value

A WebRequest descendant for the specified URI scheme.

Exceptions

Exception Type Condition
NotSupportedException The request scheme specified in requestUri is not registered.
ArgumentNullException requestUri is a null reference (Nothing in Visual Basic).
SecurityException The caller does not have permission to connect to the requested URI or a URI that the request is redirected to.

Remarks

The CreateDefault method returns a WebRequest descendant instance based on only the scheme portion of a URI.

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

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

WebRequest Class | WebRequest Members | System.Net Namespace

© 2010 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker