To declare a method as WebMethod, write the WebMethod attribute while defining it. It is used to expose a method as Web Service method or make the method accessible from PageMethods in ASP.NET AJAX.
[WebMethod]
public static string GetData(string f, string s)
{
Person p = new Person();
p.Forename = f;
p.Surname = s;
// throw new Exception("Custom Error :) ");
return SerializeObjectIntoJson(p);
}
Thanks