How to make a method of a web service class accessible through the internet?
Purushottam Rathore
First create asmx class file and in that file write this below code web service method /// /// Summary description for CommonWebService/// [WebService(Namespace = "http://microsoft.com/webservices/")][WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)][System.ComponentModel.ToolboxItem(false)]// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. [System.Web.Script.Services.ScriptService]public class CommonWebService : System.Web.Services.WebService{BaseBL objBaseBL = new BaseBL();public CommonWebService(){//Uncomment the following line if using designed components//InitializeComponent();}//Retrieve record or fetch data on Enitity name and field name[WebMethod, ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = false)]public string RetrieveRecordExists(string name, string entity){string result = "";DataSet ds = new DataSet();ds = objBaseBL.RetrieveRecordExists(name, entity);if (ds != null){result = ReturnJson.GetJson(ds);}return result;} }/// call this method with java script and jason
By qualifying the method with the WebMethod attribute.
WebMethod