private void Load()
        {
            this.Items = new Dictionary <string, AmazonUser>();

            XmlNodeList xmlNodes = this.Document.DocumentElement.SelectNodes("User");

            AmazonUser user;

            foreach (XmlNode xmlNode in xmlNodes)
            {
                user          = new AmazonUser();
                user.Id       = Guid.Parse(xmlNode.Attributes["IdUser"].Value);
                user.Client   = xmlNode.Attributes["Client"].Value;
                user.AmazonId = xmlNode.Attributes["AmazonId"].Value;

                this.Items.Add(user.AmazonId, user);
            }
        }
        private void Authenticate(HttpContext context)
        {
            AmazonUsers users = new AmazonUsers();

            if (!users.Items.ContainsKey(context.Request.Params["User"]))
            {
                throw new Exception("AccessDenied.");
            }

            AmazonUser amazonUser = users.Items[context.Request.Params["User"]];

            string clientName = amazonUser.Client;

            Global.ClientManager = new ApplicationUtilities.Classes.ClientManager(Path.Combine(
                                                                                      ConfigurationManager.AppSettings["ApplicationPath"],
                                                                                      "App_Data",
                                                                                      "Clients.xml"
                                                                                      ));
            Global.LanguageManager = new LanguageManager(amazonUser.Client, context.Request.PhysicalApplicationPath);
            HttpContext.Current.Session["Language"] = Language.English;

            string connectionString = string.Format(
                ConfigurationManager.AppSettings["ConnectionString"],
                Global.ClientManager.GetDatabaseName(clientName)
                );

            // Create a new database core for the session.
            Global.Core = new DatabaseCore.Core(
                ConfigurationManager.AppSettings["DatabaseProvider"],
                connectionString,
                ConfigurationManager.AppSettings["DatabaseProviderUserManagement"],
                connectionString,
                new string[0]
                );

            // Set the database core's file storage path.
            Global.Core.FileStorageRoot = string.Format(
                ConfigurationManager.AppSettings["FileStorageRoot"],
                clientName
                );

            // Initialize the session's language manager.
            Global.LanguageManager = new LanguageManager(
                clientName,
                context.Request.PhysicalApplicationPath
                );

            /*if (!Directory.Exists(Global.Core.FileStorageRoot))
             *  Directory.CreateDirectory(Global.Core.FileStorageRoot);
             *
             * Global.Core.LogDirectory = ConfigurationManager.AppSettings["DatabaseChangeLogDirectory"];*/

            Global.Core.ClientName       = clientName;
            Global.Core.CaseDataVersion  = Global.ClientManager.GetSingle(clientName).CaseDataVersion;
            Global.Core.CaseDataLocation = Global.ClientManager.GetSingle(clientName).CaseDataLocation;

            Global.IdUser = amazonUser.Id;

            Global.UserDefaults = new UserDefaults(Path.Combine(
                                                       ConfigurationManager.AppSettings["ApplicationPath"],
                                                       "Fileadmin",
                                                       "UserDefaults",
                                                       Global.Core.ClientName,
                                                       Global.IdUser.Value + ".xml"
                                                       ));

            Global.PermissionCore = new PermissionCore.PermissionCore(
                ConfigurationManager.AppSettings["ApplicationPath"],
                "LinkOnline",
                Global.Core.ClientName
                );
        }