This is the last post in this mini-series on implementing client side NTLM authentication within a NETCF Version 1.0 application. In this code snippet, the class that performs the actual authentication process is intialized and registered with the AuthenticationManager class. The web service can then be invoked after passing the required credentials. Authentication will be performed using NTLM.

   using Microsoft.Authentication.NTLM;

   //During Initialization Register the class that implements
   //This needs to be done only once.
   AuthenticationManager.Register(new NTLMAuth());
   //Initialize the Web Service
   SecureWS service = new SecureWS();
   //Supply the credentials
   System.Net.NetworkCredential Creds = new NetworkCredential("MyName", "MyPassWord", "DOMAIN");
   service.Credentials = Creds;

   //Call WebMethods from the WebService.