private void BlockTransferingOrRestoringPortal(Tenant tenant) { if (tenant.Status != TenantStatus.Restoring && tenant.Status != TenantStatus.Transfering) { return; } // allow requests to backup handler to get access to the GetRestoreStatus method var handlerType = typeof(BackupAjaxHandler); var backupHandler = handlerType.FullName + "," + handlerType.Assembly.GetName().Name + ".ashx"; var passthroughtRequestEndings = new[] { ".js", ".css", ".less", backupHandler, "PreparationPortal.aspx" }; if (passthroughtRequestEndings.Any(path => Request.Url.AbsolutePath.EndsWith(path, StringComparison.InvariantCultureIgnoreCase))) { return; } if (Request.Url.AbsolutePath.StartsWith(SetupInfo.WebApiBaseUrl, StringComparison.InvariantCultureIgnoreCase) || Request.Url.AbsolutePath.EndsWith(".svc", StringComparison.InvariantCultureIgnoreCase) || Request.Url.AbsolutePath.EndsWith(".ashx", StringComparison.InvariantCultureIgnoreCase)) { // we shouldn't redirect Response.StatusCode = (int)HttpStatusCode.ServiceUnavailable; Response.End(); } Response.Redirect("~/PreparationPortal.aspx?type=" + (tenant.Status == TenantStatus.Transfering ? "0" : "1"), true); }
private void BlockRemovedOrSuspendedPortal(Tenant tenant) { if (tenant.Status != TenantStatus.RemovePending && tenant.Status != TenantStatus.Suspended) { return; } var passthroughtRequestEndings = new[] { ".js", ".css", ".less", "confirm.aspx" }; if (tenant.Status == TenantStatus.Suspended && passthroughtRequestEndings.Any(path => Request.Url.AbsolutePath.EndsWith(path, StringComparison.InvariantCultureIgnoreCase))) { return; } Response.Redirect(SetupInfo.NoTenantRedirectURL + "?url=" + Request.GetUrlRewriter().Host, true); }