Considering you have your solution opened:
- Right click on the project name (at the solution explorer), go to "Add" and than "Add new item..."

- Select "Visual C#", scroll down, select "Web Service (ASMX)" and click "Add".

A file called WebService.asmx (Or the name you entered) was create on the root folder of your project. Inside, you should see that code:
<%@ WebService Language="C#" CodeBehind="~/App_Code/WebService.cs" Class="WebService" %>
This file is just used to call the code, at "~/App_Code/WebService.cs". So if you want to call it from POST / GET, you should use:
www.host.com/pathTo/projectRoot/WebService.asmx/functionName?Params=values
After opening "~/App_Code/WebService.cs", you should see something like that:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
/// <summary>
/// Summary description for WebService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// 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 WebService : System.Web.Services.WebService
{
public WebService()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string HelloWorld()
{
return "Hello World";
}
}
Now, you can customize your code to receive and process POST / GET data.
Note that instead of using Request["param"]
, you should use HttpContext.Current.Request["param"];
.
POST
is meaningless since SOAP works with POST anyway