Hi @Jason Peng,
The asp.net core server does not recognize AVIF as an image type so it cannot correctly render it on the page even if the browser can support it.
So you need to modify the StaticFiles middleware to enable the support for it.
More details, you could refer to below codes:
// Set up custom content types - associating file extension to MIME type
var provider = new FileExtensionContentTypeProvider();
// Add new mappings
provider.Mappings[".avif"] = "image/avif";
app.UseStaticFiles(new StaticFileOptions
{
ContentTypeProvider = provider
});
Result:
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.