Export (0) Print
Expand All

WebRequest.RegisterPrefix Method

Registers a WebRequest descendant for the specified URI.

[Visual Basic]
Public Shared Function RegisterPrefix( _
   ByVal prefix As String, _
   ByVal creator As IWebRequestCreate _
) As Boolean
[C#]
public static bool RegisterPrefix(
 string prefix,
 IWebRequestCreate creator
);
[C++]
public: static bool RegisterPrefix(
 String* prefix,
 IWebRequestCreate* creator
);
[JScript]
public static function RegisterPrefix(
   prefix : String,
 creator : IWebRequestCreate
) : Boolean;

Parameters

prefix
The complete URI or URI prefix that the WebRequest descendant services.
creator
The create method that the WebRequest calls to create the WebRequest descendant.

Return Value

true if registration is successful; otherwise, false.

Exceptions

Exception Type Condition
ArgumentNullException prefix is a null reference (Nothing in Visual Basic)

-or-

creator is a null reference (Nothing).

Remarks

The RegisterPrefix method registers WebRequest descendants to service requests. WebRequest descendants are typically registered to handle a specific protocol, such HTTP or FTP, but can be registered to handle a request to a specific server or path on a server.

Duplicate prefixes are not allowed. RegisterPrefix returns false if an attempt is made to register a duplicate prefix.

Note   The HttpWebRequest class is registered to service requests for HTTP and HTTPS schemes by default. Attempts to register a different WebRequest descendant for these schemes will fail.

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

Show:
© 2014 Microsoft