Posts

Showing posts with the label ASP.NET Web Service

Pass data to ASP.NET Web Service (ASMX) from Cross-Origin

Image
In this blog, we are going to create “Hello World” ASP.Net Web Service (ASMX) with parameter and allow request from cross-origin. Now here we implement ASP.Net Web Service from Visual Studio 2017.   We have created empty ASP.Net Web Application solution and added “demo.asmx” in solution. Then, added code for “HelloWorld” method with “name” parameter as mention below snippet: [WebMethod]      [ScriptMethod(ResponseFormat = ResponseFormat.Json)]      public   string  HelloWorld( string  text)      {      return   "Hello World "  + text;      }   We will invoke this web service using HTTP verb. So, we defined “ScriptMethodAttribute” for set response format JSON. We need to enable script service to invoke & pass parameter in Web Service from script as shown in below screenshot: Then...