Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
1.40/5 (3 votes)
See more:
hi...
I want to simple example that is use web services in asp.net c#



thanks
Posted

Hi.
Look at this article Web Services and ASP
 
Share this answer
 
What you really need to know first is how to use google. It is your friend and returns about 13,000,000 results when searching your exact subject. how to use webservices in asp.net C#[^]
 
Share this answer
 
A very simple example is here on this link hope it will help if helped mark it as answer
http://www.aspdotnet-suresh.com/2011/05/aspnet-web-service-or-creating-and.html[^]
 
Share this answer
 
right click on your solution => add => new Item => web service, and then form your solution make a new project, build project, opern your webservice in browser , right click on another refrence folder => add web refrence => discover=> ok!

now if you using namespace of your service , you can use the methods in them!

this is a web service for check the username!
C#
using System.Linq;
using System.Web;
using System.Web.Services;

namespace AspNetAjax_Examples
{
    /// <summary>
    /// Summary description for HelperWebService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [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 HelperWebService : System.Web.Services.WebService
    {

        [WebMethod]
        public bool CheckUsername(string Username)
        {
            System.Threading.Thread.Sleep(3000);
            string url = HttpContext.Current.Request.UrlReferrer.ToString();

            var Context = new AdvancedASP_8_ExamplesEntities();
            return (from u in Context.Users
                    where u.Username.ToLower() == Username.ToLower()
                    select u).Any();
        }
    }
}
 
Share this answer
 
Comments
Mas11 19-Jul-13 6:00am    
Nice Answer !
Have a Have a Question or ComHave a Question or Comment?ment?Question or Comment?Have a QuesRead the question carefully.
Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.

Let's work to help developers, not make them feel stupid. www.google.cotion or CHave a Question or Comment?omment?
 
Share this answer
 
Comments
prp_rakesh 16-Aug-13 9:16am    
give me a total sol'n..
 
Share this answer
 
Comments
CHill60 20-Jul-13 15:30pm    
Sorry - didn't think it was that "wonderful"
Mas11 22-Jul-13 0:28am    
Have you read above question properly. He is beginner in WebService & for that its perfect link.
right click on your solution => add => new Item => web service, and then form your solution make a new project, build project, opern your webservice in browser , right click on another refrence folder => add web refrence => discover=> ok!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900