chore: replace legacy routing code with proper 3.1
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
f0535f7797
commit
4b6e560e6d
30
Startup.cs
30
Startup.cs
|
@ -35,11 +35,9 @@ namespace pwt_0x01_ng
|
|||
options.HttpOnly = HttpOnlyPolicy.Always;
|
||||
options.Secure = CookieSecurePolicy.Always;
|
||||
});
|
||||
services.Configure<MvcOptions>(options => {
|
||||
/* necessary due to a switch to 3.1 */
|
||||
options.EnableEndpointRouting = false;
|
||||
});
|
||||
|
||||
services.AddControllersWithViews();
|
||||
services.AddRazorPages();
|
||||
|
||||
var connectionString = Environment.GetEnvironmentVariable("DB_CONNECTION_STRING");
|
||||
services.AddDbContext<DBContext>(options =>
|
||||
|
@ -64,19 +62,23 @@ namespace pwt_0x01_ng
|
|||
app.UseExceptionHandler("/Home/Error");
|
||||
}
|
||||
|
||||
app.UseRouting();
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapRazorPages();
|
||||
endpoints.MapControllerRoute(
|
||||
name: "areas",
|
||||
pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}"
|
||||
);
|
||||
endpoints.MapControllerRoute(
|
||||
name: "default",
|
||||
pattern: "{controller=Home}/{action=Index}/{id?}"
|
||||
);
|
||||
});
|
||||
|
||||
app.UseStaticFiles();
|
||||
app.UseCookiePolicy();
|
||||
|
||||
app.UseMvc(routes =>
|
||||
{
|
||||
routes.MapRoute(
|
||||
name: "areas",
|
||||
template: "{area:exists}/{controller=Home}/{action=Index}/{id?}"
|
||||
);
|
||||
routes.MapRoute(
|
||||
name: "default",
|
||||
template: "{controller=Home}/{action=Index}/{id?}");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue