GetWorkflowService

public IWFWorkflowService GetWorkflowService ()
{
    string user = this.Context.User.Identity.Name;
             
    // Set Credentials – Windows Authentication
    System.Net.ICredentials credentials = 
        System.Net.CredentialCache.DefaultCredentials;
    // In case of form authentication
    //System.Net.NetworkCredential credentials = new 
        System.Net.NetworkCredential(userName, password, domain);
 
    string locale = "en-us";
       
    string workFlowBinding = 
        (String)ConfigurationSettings.AppSettings["WorkFlowBindingUsed"];
    IWFWorkflowService m_api = new WCFWorkflowProxy("MyApplicationName", 
              "", locale, user, credentials, workFlowBinding);

    return m_api;
}