C#C
C#3y ago
shack

✅ aspnet core not recognizing images

I made a project in jb rider, and for some reason imgs in html are getting a 404. I had this problem with css and js scripts before, but I fixed it by including a separate get method for each of them. When I tried making one for the img, it only removed the console error. Nothing was found in Chrome Sources, and when I tried to download the image chrome had, I couldn't open it.

Startup.cs
endpoints.MapGet("/", async context =>
  {
    await context.Response.WriteAsync(await  File.ReadAllTextAsync("wwwroot/html/index.html"));
  });


index.html
    <img alt="img" src="/img.jpeg">
image.png
image.png
Was this page helpful?