- Open Visual studio and create new Website.
- Right Click on Website and Click on 'Add New Item'.
- A New Window will Open, select 'Web Service' , name it and click 'Add'.
- When you click 'Add' Button, new files ( with .asmx and .cs extensions ) will be added to Project.
- Visual Studio will add some code in it.
- A default Web Method named 'Helloworld' will also be added in it.
- You have created ASMX Web Service Successfully.
- Replace 'Helloworld' Web Method with following code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[WebMethod] | |
public string CallmyName(string name) { | |
return "You are '" + name + ";"; | |
} | |
- This is Custom Web Method we created for our ASMX Web Service.
In next tutorial, we will learn how to use this Web Service.