@@ -1,5 +1,4 @@
|
||||
using CarCareTracker.External.Implementations;
|
||||
using CarCareTracker.External.Interfaces;
|
||||
using CarCareTracker.External.Interfaces;
|
||||
using CarCareTracker.Filter;
|
||||
using CarCareTracker.Helper;
|
||||
using CarCareTracker.Logic;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using CarCareTracker.External.Interfaces;
|
||||
using CarCareTracker.Models;
|
||||
using LiteDB;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using CarCareTracker.Helper;
|
||||
using CsvHelper;
|
||||
|
||||
16
Program.cs
16
Program.cs
@@ -107,7 +107,21 @@ var app = builder.Build();
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
app.UseExceptionHandler("/Home/Error");
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseStaticFiles(new StaticFileOptions
|
||||
{
|
||||
OnPrepareResponse = ctx =>
|
||||
{
|
||||
if (ctx.Context.Request.Path.StartsWithSegments("/images") || ctx.Context.Request.Path.StartsWithSegments("/documents"))
|
||||
{
|
||||
ctx.Context.Response.Headers.Add("Cache-Control", "no-store");
|
||||
if (!ctx.Context.User.Identity.IsAuthenticated)
|
||||
{
|
||||
ctx.Context.Response.Redirect("/Login");
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user