HttpContext.Server HttpContext.Server HttpContext.Server HttpContext.Server Property

定義

取得 HttpServerUtility 物件,其提供用以處理 Web 要求的方法。Gets the HttpServerUtility object that provides methods used in processing Web requests.

public:
 property System::Web::HttpServerUtility ^ Server { System::Web::HttpServerUtility ^ get(); };
public System.Web.HttpServerUtility Server { get; }
member this.Server : System.Web.HttpServerUtility
Public ReadOnly Property Server As HttpServerUtility

屬性值

備註

Server屬性會提供以程式設計方式存取的屬性和方法HttpServerUtility類別。The Server property provides programmatic access to the properties and methods of the HttpServerUtility class. 因為 ASP.NET 網頁包含的預設參考System.Web命名空間 (其中包含HttpContext類別),您可以參考的成員HttpContext在.aspx 頁面上,而不需使用完整的類別參考給HttpContextBecause ASP.NET pages contain a default reference to the System.Web namespace (which contains the HttpContext class), you can reference the members of HttpContext on an .aspx page without using the fully qualified class reference to HttpContext. 例如,您可以使用Server.CreateObject("MyCOMComponent")在伺服器上建立 COM 物件的執行個體。For example, you can use Server.CreateObject("MyCOMComponent") to create an instance of a COM object on the server. 不過,如果您想要使用的成員HttpServerUtility從 ASP.NET 程式碼後置模組,您必須包含的參考System.Web命名空間中的模組,這兩個目前作用中的要求/回應內容的完整的參考,類別在System.Web您想要使用。However, if you want to use the members of HttpServerUtility from an ASP.NET code-behind module, you must include a reference to the System.Web namespace in the module and a fully qualified reference to both the currently active request/response context and the class in System.Web that you want to use. 例如,在程式碼後置頁面中您必須指定完整格式的名稱HttpContext.Current.Server.CreateObject("MyCOMComponent")For example, in a code-behind page you must specify the fully qualified name HttpContext.Current.Server.CreateObject("MyCOMComponent").

適用於