Skip to content

Instantly share code, notes, and snippets.

@christiannagel
Created May 24, 2018 09:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christiannagel/e194d148f31afcfbc8d9897d9a5fc757 to your computer and use it in GitHub Desktop.
Save christiannagel/e194d148f31afcfbc8d9897d9a5fc757 to your computer and use it in GitHub Desktop.
Middleware configuration with ASP.NET Core 2.1
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseCookiePolicy();
app.UseAuthentication();
app.UseMvc(routes =>
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment