2020-03-05 17:49:27 +00:00
|
|
|
|
using System;
|
|
|
|
|
using Microsoft.AspNetCore.Builder;
|
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
2021-05-21 16:43:15 +00:00
|
|
|
|
using Microsoft.Extensions.Hosting;
|
2020-03-05 17:49:27 +00:00
|
|
|
|
|
|
|
|
|
namespace aspnetapp
|
|
|
|
|
{
|
|
|
|
|
public class Startup
|
|
|
|
|
{
|
|
|
|
|
public Startup(IConfiguration configuration)
|
|
|
|
|
{
|
|
|
|
|
Configuration = configuration;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IConfiguration Configuration { get; }
|
|
|
|
|
|
|
|
|
|
// This method gets called by the runtime. Use this method to add services to the container.
|
|
|
|
|
public void ConfigureServices(IServiceCollection services)
|
|
|
|
|
{
|
|
|
|
|
services.Configure<CookiePolicyOptions>(options =>
|
|
|
|
|
{
|
|
|
|
|
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
|
|
|
|
|
options.CheckConsentNeeded = context => true;
|
|
|
|
|
options.MinimumSameSitePolicy = SameSiteMode.None;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
2021-05-21 16:43:15 +00:00
|
|
|
|
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
|
|
|
|
|
services.AddControllers();
|
2020-03-05 17:49:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
2021-05-21 16:43:15 +00:00
|
|
|
|
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
2020-03-05 17:49:27 +00:00
|
|
|
|
{
|
|
|
|
|
if (env.IsDevelopment())
|
|
|
|
|
{
|
|
|
|
|
app.UseDeveloperExceptionPage();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
app.UseExceptionHandler("/Home/Error");
|
|
|
|
|
app.UseHsts();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
app.UseStaticFiles();
|
|
|
|
|
app.UseCookiePolicy();
|
2021-05-21 16:43:15 +00:00
|
|
|
|
app.UseRouting();
|
2020-03-05 17:49:27 +00:00
|
|
|
|
|
2021-05-21 16:43:15 +00:00
|
|
|
|
app.UseEndpoints(e => e.MapControllerRoute(
|
|
|
|
|
name: "default",
|
|
|
|
|
pattern: "{controller=Home}/{action=Index}/{id?}"));
|
2020-03-05 17:49:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|