Purushottam Rathore
How to make a method of a web service class accessible through the internet?
By Purushottam Rathore in ASP.NET on Mar 03 2011
  • Milind bilonia
    Jun, 2016 11

    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

    • 0
  • Purushottam Rathore
    Mar, 2011 3

    By qualifying the method with the WebMethod attribute.

    For Example:
     
    C#
        [WebMethod()]
       
    public string MethodName()
     
    VB
       
    <WebMethod()> _
       
    Public Function MethodName() As String

    • 0


Most Popular Job Functions


MOST LIKED QUESTIONS