WebRequest.CreatorInstance 属性

定义

注意

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

当在子类中重写时,获取从 IWebRequestCreate 类派生的工厂对象,该类用于创建为生成对指定 URI 的请求而实例化的 WebRequest

public:
 virtual property System::Net::IWebRequestCreate ^ CreatorInstance { System::Net::IWebRequestCreate ^ get(); };
[System.Obsolete("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)]
public virtual System.Net.IWebRequestCreate CreatorInstance { get; }
[<System.Obsolete("This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.", true)>]
member this.CreatorInstance : System.Net.IWebRequestCreate
Public Overridable ReadOnly Property CreatorInstance As IWebRequestCreate

属性值

Create(Uri) 方法返回的派生 WebRequest 类型。

属性

注解

此属性允许应用程序确定 IWebRequestCreate 用于创建请求的派生工厂对象。 此对象可以是 System.Net.Browser.WebRequestCreator.BrowserHttpSystem.Net.Browser.WebRequestCreator.ClientHttp,但它也可能是派生自 IWebRequestCreate的自定义实例。 这允许应用程序确定托管 Silverlight 的浏览器、Silverlight 客户端还是某些自定义对象处理实例的 WebRequest HTTP 请求和响应。 方法 RegisterPrefix 允许应用程序配置在向特定 URI 发出请求时将实例化哪个派生 WebRequest 类型。 WebRequest 创建者通常注册以处理特定协议(如 HTTP 或 HTTPS),但可以注册以处理对服务器上特定服务器或路径的请求。 当多个派生 WebRequest 类型可以处理同一协议的请求时,这非常有用。 Microsoft Silverlight 3 及更高版本的运行时支持多个 HTTP 处理程序,每个处理程序具有不同的功能。 例如,使用代表性状态传输 (REST) 的 Web 服务可能需要 System.Net.Browser.WebRequestCreator.ClientHttp 处理程序,而 SOAP Web 服务可能能够使用默认 System.Net.Browser.WebRequestCreator.BrowserHttp 处理程序。

适用于