Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create an ASMX web service page without a code behind file

Tags:

c#

asp.net

I have been able to create ASPX pages without the code behind, but I can't for the life of me figure out the magic combination to get an ASMX page to work without a code behind. Is this even possible?

like image 656
Goyuix Avatar asked Jan 13 '09 01:01

Goyuix


1 Answers

Quick sample:

<%@ WebService Language="C#" Class="SampleWebService" %>
using System;
using System.Data;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class SampleWebService : System.Web.Services.WebService
{

    [WebMethod]
    public string Hello()
    {
        return "Hello World!";
    }

    [WebMethod]
    public string DoStuff(out string stuff)
    {
        stuff = "Woohoo!";
        return "OK";
    }
}
like image 81
Stobor Avatar answered Oct 22 '22 21:10

Stobor