WebRequest.CreatorInstance 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
注意
This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.
在后代类中重写时,获取派生自 IWebRequestCreate 用于创建 WebRequest 实例化的工厂对象,以便向指定的 URI 发出请求。
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.BrowserHttp)或 System.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) 处理程序。