GetAdminService

public IWFAdminService GetAdminService()
{
    // initiated an object of proxy class of AgilePoint Web Service
    IWFAdminService svc = new AdminService("http://[machine]/[virtual
        directory]");
    // set URL
    svc.CookieContainer = new System.Net.CookieContainer();
    // set Credentials
    svc.Credentials = new System.Net.NetworkCredential(userName, password,
        domainName);
    // or take default credential
    // svc.Credentials = System.Net.CredentialCache.DefaultCredentials;

    try
    {
        // set client application name
        svc.SetClientAppName("Samples");
        // set locale
        svc.SetClientLocale("en-US"); // AgilePoint support 13 languages
        // check authenticated and return qualified user name
        string qualifiedDomainUserName = svc.CheckAuthenticated(); 
    }

    catch(Exception ex)
    {
        string error = ShUtil.GetSoapMessage(ex)
        //log/throw the exception
    }

    Finally
    {
        return svc;
    }
}