| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- <%@ WebService Language="C#" Class="Samples.AspNet.WebService" %>
-
- using System;
- using System.Web;
- using System.Web.Services;
- using System.Xml;
- using System.Web.Services.Protocols;
- using System.Web.Script.Services;
-
- namespace Samples.AspNet
- {
- [WebService(Namespace = "http://tempuri.org/")]
- [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
- [ScriptService]
- public class WebService : System.Web.Services.WebService
- {
- [WebMethod]
- public string Div(int a, int b)
- {
- if (b == 0)
- throw new DivideByZeroException ("Attempted to divide by zero.");
-
- int division = a / b;
- string result =
- String.Format("The division result is {0}.",
- division.ToString());
- return result;
- }
-
-
- }
-
-
- }
|