<%@ WebService Language="C#" Class="MyMath" %> using System.Web.Services; public class MyMath { [ WebMethod ] public int Add(int num1, int num2) { return num1+num2; } }
[C#] <%@ WebService Language="C#" Class="Math" Debug=true%> using System.Web.Services; using System;
[WebService(Namespace="http://www.contoso.com/")] public class Math { [ WebMethod ] public int Add(int num1, int num2) { return num1+num2; } } [Visual Basic] <%@ WebService Language="VB" Class="Math"%> Imports System.Web.Services Imports System
<WebService(Namespace:="http://www.contoso.com/")> _ Public Class Math <WebMethod()> Public Function Add(num1 As Integer, num2 As Integer) As Integer Return num1 + num2 End Function End Class
[C#] <%@ WebService Language="C#" Class="Util" %> using System; using System.Web.Services;
public class Util: WebService { [ WebMethod(Description="Returns the time as stored on the Server",EnableSession=false)] public string Time() { return Context.Timestamp.TimeOfDay.ToString(); } } [Visual Basic] <%@ WebService Language="VB" Class="Util"