January 26, 2021
Hot Topics:

Client Application Services: Getting Started

  • By Vikas Goyal
  • Send Email »
  • More Articles »


Now, you can create a sample ASP.NET application service and use it from a Windows Client using Client Application Services. The following sample uses Authentication request as an example.

Creating and Configuring an ASP.NET Application Service

  1. Create a new ASP.NET 3.5 Web Service Application using Visual Studio 2008. Name the application, say, 'ClientAppService'.

  2. Click here for a larger image.

    Figure 4: Create new ASP.NET Web Service Application

  3. Add the following XML code parallel to the <system.web> tag in the web service's web.config file.

             <authenticationService enabled="true"
                                    requireSSL = "false"/>

    This code will expose the authentication service as a web service.

  4. Add the following XML code inside the <system.web> tag.

    <membership defaultProvider="SampleProvider">
          <add name="SampleProvider"

    This configures the Membership framework to use the custom 'SampleProvider' that will be developed in the next steps. The Membership provider is responsible for managing and validating the credentials.

  5. Change the authentication mode to 'Forms' from the default value of 'Windows' because you will use 'Forms' authentication from your client code.
  6. <authentication mode="Forms" />
  7. Add a 'SampleProvider' class to the Web Service Application. It should inherit from the System.Web.Security.MembershipProvider class.
  8. public class SampleProvider : MembershipProvider
  9. Implement the ValidateUser method of the class. For this walkthrough, credentials have been hard coded, but in a real application they should be placeed in some data store.
  10. public override bool ValidateUser(string username,
       string password)
       bool flag = false;
       if (username == "SampleUser" &&
           password == "SamplePassword")
          flag = true;
       return flag;
  11. Change the Project Properties to run the web service on a fixed port.

    Project -> ClientAppService Properties -> Web -> Change the default setting of 'Auto-assign Port' to 'Specific Port' as shown in Figure 5.

    Also, change the virtual path to '/ClientAppService'.

    Click here for a larger image.

    Figure 5: Configure Web Service to run on a fixed port

  12. Build and start the Web Service Application.

Page 2 of 3

This article was originally published on March 19, 2008

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date