IWebRequestCreate.Create(Uri) IWebRequestCreate.Create(Uri) IWebRequestCreate.Create(Uri) Method

定义

创建一个 WebRequest 实例。Creates a WebRequest instance.

public:
 System::Net::WebRequest ^ Create(Uri ^ uri);
public System.Net.WebRequest Create (Uri uri);
abstract member Create : Uri -> System.Net.WebRequest

参数

uri
Uri Uri Uri

Web 资源的统一资源标识符 (URI)。The uniform resource identifier (URI) of the Web resource.

返回

一个 WebRequest 实例。A WebRequest instance.

异常

IWebRequestCreate 实例不支持 uri 中指定的请求方案。The request scheme specified in uri is not supported by this IWebRequestCreate instance.

适用于 Windows 应用商店应用的 .NET可移植类库中,改为捕获基类异常 FormatExceptionIn the .NET for Windows Store apps or the Portable Class Library, catch the base class exception, FormatException, instead.

uri 中指定的 URI 不是有效的 URI。The URI specified in uri is not a valid URI.

注解

方法必须返回WebRequest子代的已初始化实例, 该子代能够为协议执行标准请求/响应事务, 无需修改任何特定于协议的字段。 CreateThe Create method must return an initialized instance of the WebRequest descendant that is capable of performing a standard request/response transaction for the protocol without needing any protocol-specific fields modified.

适用于