How to declare a method as WebMethod?

Posted by Raja under ASP.NET category on | Views : 7239
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.

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);


Comments or Responses

Login to post response