HttpGetClientProtocol.GetWebRequest(Uri) 方法

定义

为指定的 URI 创建一个 WebRequest 实例。Creates a WebRequest instance for the specified URI.

protected:
 override System::Net::WebRequest ^ GetWebRequest(Uri ^ uri);
protected override System.Net.WebRequest GetWebRequest (Uri uri);
override this.GetWebRequest : Uri -> System.Net.WebRequest
Protected Overrides Function GetWebRequest (uri As Uri) As WebRequest

参数

uri
Uri

Uri 在创建 WebRequest 时使用。The Uri to use when creating the WebRequest.

返回

WebRequest

WebRequest 实例。The WebRequest instance.

例外

uri 参数为空或长度为零。The uri parameter is null or has a length of zero.

注解

此方法重写的基版本 GetWebRequest ,以指定使用 HTTP GET 发出对 XML Web service 的 http 请求。This method overrides the base version of GetWebRequest to specify that the HTTP request to the XML Web service is made using HTTP-GET. 通过重写此方法,可在 WebRequest 发出 XML Web service 请求之前对对象进行其他自定义。By overriding this method, additional customizations can be made to the WebRequest object before the XML Web service request is made. 例如,可以将自定义标头添加到请求。For example you could add a custom header to the request.

适用于

另请参阅