This documentation is archived and is not being maintained.

WebServiceAttribute Constructor

Initializes a new instance of the WebServiceAttribute class.

[Visual Basic]
Public Sub New()
public WebServiceAttribute();
public: WebServiceAttribute();
public function WebServiceAttribute();


[Visual Basic] 
<%@ WebService Language="VB" class= "ServerVariables"%>
Imports System
Imports System.Web.Services
Imports System.Web.Services.Protocols

<WebService(Namespace := "")> _
Public Class ServerVariables
    Inherits WebService

    <WebMethod(Description := "Returns the time as stored on the Server", _
        EnableSession := False)> _
    Public Function Time() As String
        Return Context.Timestamp.TimeOfDay.ToString()
    End Function
End Class

<%@ WebService Language="C#" class= "ServerVariables"%>
 using System;
 using System.Web.Services;
 using System.Web.Services.Protocols;
 [ WebService(Namespace="")]
 public class ServerVariables: WebService {
    [ WebMethod(Description="Returns the time as stored on the Server",EnableSession=false)]
    public string Time() {
       return Context.Timestamp.TimeOfDay.ToString();

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

WebServiceAttribute Class | WebServiceAttribute Members | System.Web.Services Namespace