public void Configure(IApplicationBuilder app, PageAccessRecorder recorder) { recorder.Start(); if (_isDevelopment) { app.UseDeveloperExceptionPage(); } else if (!_runningInContainer) { app.UseRewriter(new RewriteOptions().AddRedirectToHttps()); } // Re-purposing the "blog post not found" page for all general errors, which would mostly be 404s // anyway since we handle 500's separately through an action filter. const string errorPath = "/blog/an-entry-that-should-never-exist"; app .UseHealthChecks("/health") .UseMiddleware <ThemeSwitcherMiddleware>() .UseMiddleware <PageAccessRecorderMiddleware>() .UseMiddleware <HttpCache>() .UseStatusCodePagesWithReExecute(errorPath) .UseResponseCompression() .UseMiddleware <BlogImageServer>() .UseRouting() .UseEndpoints(e => e.MapDefaultControllerRoute()) .UseFileServer(); }
public HomeController( BlogCache blogCache, ProfileRepository profileRepository, AccessKeyValidator accessKeyValidator, MetadataGenerator metadataGenerator, PageAccessRecorder pageAccessRecorder) { _blogCache = blogCache; _profileRepository = profileRepository; _accessKeyValidator = accessKeyValidator; _metadataGenerator = metadataGenerator; _pageAccessRecorder = pageAccessRecorder; }
public PageAccessRecorderMiddleware(RequestDelegate next, PageAccessRecorder recorder) { _next = next; _recorder = recorder; }