public Axapta Logon() { // NameValueCollection settings = (NameValueCollection)System.Configuration.ConfigurationSettings.GetConfig("AXConnection "); string username = System.Configuration.ConfigurationSettings.AppSettings["UserName"].ToString(); string password = System.Configuration.ConfigurationSettings.AppSettings["PassWord"].ToString(); string domain = System.Configuration.ConfigurationSettings.AppSettings["Domain"].ToString(); string defaultCompany = System.Configuration.ConfigurationSettings.AppSettings["DefaultCompany"].ToString(); string defaultLanguage = System.Configuration.ConfigurationSettings.AppSettings["DefaultLanguage"].ToString(); string instance = System.Configuration.ConfigurationSettings.AppSettings["Instance"].ToString();// 'DynamicsAxStd@AX4.0:2712' Axapta Ax = new Axapta(); Ax.Refresh(); NetworkCredential netCredential = new NetworkCredential(username,password,domain); Ax.LogonAs(username, domain, netCredential, defaultCompany, defaultLanguage, instance,null); return Ax; }