public async Task InvokeAsync(HttpContext context, IWebHelper webHelper) { if (!DataSettingsHelper.DatabaseIsInstalled()) { var installUrl = string.Format("{0}install", webHelper.GetAgencyLocation()); if (!webHelper.GetThisPageUrl(false).StartsWith(installUrl, StringComparison.OrdinalIgnoreCase)) { context.Response.Redirect(installUrl); return; } } await _next(context); }