Commit: Allow File Types.
This commit is contained in:
22
Program.cs
22
Program.cs
@@ -23,7 +23,27 @@ if (!app.Environment.IsDevelopment())
|
|||||||
|
|
||||||
app.UseHttpsRedirection();
|
app.UseHttpsRedirection();
|
||||||
app.UseCors();
|
app.UseCors();
|
||||||
app.UseStaticFiles();
|
app.UseStaticFiles(new StaticFileOptions
|
||||||
|
{
|
||||||
|
ServeUnknownFileTypes = true, // Allows serving unknown file types
|
||||||
|
DefaultContentType = "application/octet-stream", // Default content type
|
||||||
|
OnPrepareResponse = ctx =>
|
||||||
|
{
|
||||||
|
var path = ctx.File.PhysicalPath.ToLowerInvariant();
|
||||||
|
if (path.EndsWith(".woff"))
|
||||||
|
{
|
||||||
|
ctx.Context.Response.ContentType = "font/woff";
|
||||||
|
}
|
||||||
|
else if (path.EndsWith(".woff2"))
|
||||||
|
{
|
||||||
|
ctx.Context.Response.ContentType = "font/woff2";
|
||||||
|
}
|
||||||
|
else if (path.EndsWith(".ico"))
|
||||||
|
{
|
||||||
|
ctx.Context.Response.ContentType = "image/x-icon";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
app.UseRouting();
|
app.UseRouting();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user