WebService Class
Defines the optional base class for XML Web services, which provides direct access to common ASP.NET objects, such as application and session state.
System.ComponentModel::MarshalByValueComponent
System.Web.Services::WebService
System.Workflow.Activities::WorkflowWebService
Assembly: System.Web.Services (in System.Web.Services.dll)
The WebService type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | Application | Gets the application object for the current HTTP request. |
![]() | Container | Gets the container for the component. (Inherited from MarshalByValueComponent.) |
![]() | Context | Gets the ASP.NET HttpContext for the current request, which encapsulates all HTTP-specific context used by the HTTP server to process Web requests. |
![]() | DesignMode | Gets a value indicating whether the component is currently in design mode. (Inherited from MarshalByValueComponent.) |
![]() | Events | Gets the list of event handlers that are attached to this component. (Inherited from MarshalByValueComponent.) |
![]() | Server | Gets the HttpServerUtility for the current request. |
![]() | Session | Gets the HttpSessionState instance for the current request. |
![]() | Site | Gets or sets the site of the component. (Inherited from MarshalByValueComponent.) |
![]() | SoapVersion | Gets the version of the SOAP protocol used to make the SOAP request to the XML Web service. |
![]() | User | Gets the ASP.NET server User object. Can be used to authenticate whether a user is authorized to execute the request. |
| Name | Description | |
|---|---|---|
![]() | Dispose() | Releases all resources used by the MarshalByValueComponent. (Inherited from MarshalByValueComponent.) |
![]() | Dispose(Boolean) | Releases the unmanaged resources used by the MarshalByValueComponent and optionally releases the managed resources. (Inherited from MarshalByValueComponent.) |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from MarshalByValueComponent.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetService | Gets the implementer of the IServiceProvider. (Inherited from MarshalByValueComponent.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ToString | Returns a String containing the name of the Component, if any. This method should not be overridden. (Inherited from MarshalByValueComponent.) |
| Name | Description | |
|---|---|---|
![]() | Disposed | Adds an event handler to listen to the Disposed event on the component. (Inherited from MarshalByValueComponent.) |
If you don't need access to the common ASP.NET objects, you can still create an XML Web service without deriving from WebService. Additional ASP.NET objects can be accessed through Context.
XML Web service methods that have the OneWay property of either SoapRpcMethodAttribute or SoapDocumentMethodAttribute set to true, do not have access to their HttpContext. As such, accessing any of the properties of the WebService class, from within that XML Web service method, return nullptr.
If you are using the .NET Framework version 1.0 XML Web service methods that have either the SoapRpcMethodAttribute or SoapDocumentMethodAttribute attribute applied to them with the OneWay property of set to true, do not have access to their HttpContext using the static Current property. To access the HttpContext, derive the class implementing the XML Web service method from WebService and access the Context property.
| Topic | Location |
|---|---|
| Walkthrough: Creating and Using an ASP.NET Web Service in Visual Web Developer | Building ASP .NET Web Applications in Visual Studio |
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.




