The 404 error suggests that the file path specified for your background image does not match the file's actual location on your server.
File Path Issue:
• You are referencing the background image as:
background: hsl(0, 0%, 90%) url("../wwwroot/data/Random.jpg") no-repeat 0 10px 20px;
However, in the Solution Explorer, the file Random.jpg is located in wwwroot/data/Random.jpg. Your path seems off.
Correct Path:
• In ASP.NET Core applications, static files are served directly from the wwwroot folder.
• The path wwwroot is the root of the static file server. So you don’t need to include wwwroot in the URL. Update the background image path to:
background: hsl(0, 0%, 90%) url("/data/Random.jpg") no-repeat 0 10px 20px;
Ensure File Exists:
• Verify that Random.jpg is located in the wwwroot/data folder.
• You can access it directly in the browser by navigating to:
http:///data/Random.jpg
Static File Middleware:
• Ensure the UseStaticFiles() middleware is added in Program.cs (or Startup.cs) to serve static files from wwwroot:
app.UseStaticFiles();