Example #1
0
        private void CheckInstallation()
        {
            bool isEditing = webContext.ToAppRelative(webContext.Url.LocalUrl)
                             .StartsWith(webContext.ToAppRelative(editUrlManager.GetManagementInterfaceUrl()), StringComparison.InvariantCultureIgnoreCase);

            if (isEditing)
            {
                return;
            }

            DatabaseStatus status      = installer.GetStatus();
            Url            redirectUrl = Url.ResolveTokens(welcomeUrl);

            if (status.NeedsUpgrade)
            {
                redirectUrl = redirectUrl.AppendQuery("action", "upgrade");
            }
            else if (!status.IsInstalled)
            {
                redirectUrl = redirectUrl.AppendQuery("action", "install");
            }
            else if (status.NeedsRebase)
            {
                redirectUrl = redirectUrl.AppendQuery("action", "rebase");
            }
            else
            {
                return;
            }
            Trace.WriteLine("Redirecting to '" + redirectUrl + "' to handle status: " + status.ToStatusString());
            webContext.Response.Redirect(redirectUrl);
        }