Skip to content

Instantly share code, notes, and snippets.

@manoj-choudhari-git
Last active May 15, 2021 20:08
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 manoj-choudhari-git/723db94c0dcc0359dd48450fb694b9be to your computer and use it in GitHub Desktop.
Save manoj-choudhari-git/723db94c0dcc0359dd48450fb694b9be to your computer and use it in GitHub Desktop.
.NET Applications - Static Files - Authorization middleware and WWWROOT
public class Startup
{
// Some other code....
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
app.UseHsts();
}
app.UseHttpsRedirection();
// Middleware - Serve Static Files
app.UseStaticFiles();
app.UseRouting();
// Authorization Middleware
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment