January 23, 2021
Hot Topics:

Client Application Services: Getting Started

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

Creating the Windows Client

  1. Create the .NET 3.5 client Windows Forms application using Visual Studio 2008 and name it, say, 'ClientApp'.

  2. Click here for a larger image.

    Figure 6: Creating a new Windows Forms Application

  3. Change the Project Properties so that the application uses Client Application Services to connect to the ASP.NET Application Service created in earlier steps.

    Project -> ClientApp Properties -> Services:

    • Select 'Enable client application services'
    • Select 'Use Forms authentication'
    • Specify the URL based on port given earlier.

    Click here for a larger image.

    Figure 7: Enable Client Application Service

  4. Add controls to the startup form to accept login credentials and also a button to submit the form, as shown in Figure 8.
  5. Figure 8: Client Login Form

  6. In the 'Login' button click event, add the following code to call the Membership API and pass the entered credentials.
  7. if (!Membership.ValidateUser(textUserName.Text,
       MessageBox.Show("Incorrect Username or Password",
                       "Pls try again",
          MessageBoxButtons.OK, MessageBoxIcon.Error);
       MessageBox.Show("Login Successful","Welcome",
          MessageBoxButtons.OK, MessageBoxIcon.Information);
  8. Build and execute the application. Make sure that Web Service created earlier is running.
  9. To test, provide wrong credentials. You will get the output shown in Figure 9.
  10. Figure 9: Output on wrong credentials

  11. Provide correct credentials this time, and the output will be as in Figure 10:
  12. Figure 10: Output on correct credentials


Client Application Services simplifies the access to ASP.NET Application Services and thus helps in managing the user information, authentication, and authorization at a common place for both web and Windows Applications.

Other important things that can be tried out using Client Application Services are:

  • Accessing directly from Client Application Services classes
  • Configuring offline support
  • Implementing logout functionality

About the Author

Vikas Goyal is a Microsoft MVP Solutions Architect with several years of industry experience. He is mainly involved in designing products/solutions for Financial Industry. He can be contacted via his web site, http://www.VikasGoyal.net; or his blog, http://dotnetwithme.blogspot.com.

Page 3 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