Then Specify a small HTML page, and write this in the lambda expression inside MapGet.
public class Startup
const string _html = "<html><body><img src=hello-world.png></body></html>";
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
// Add a wwwroot folder to the WebApplication project in Visual Studio.// ...Then drag an image to wwwroot.
endpoints.MapGet("/", async context =>
Notes, UseStaticFiles. There are several overloads of UseStaticFiles, but in my experience the call with no arguments tends to be effective for most cases.
Notes, directories. You can add directories to the wwwroot folder—for larger web applications, it is often useful to have a JS or CSS directory. An "Images" directory is also common.
Dot Net Perls is a collection of tested code examples. Pages are continually updated to stay current, with code correctness a top priority.
Sam Allen is passionate about computer languages. In the past, his work has been recommended by Apple and Microsoft and he has studied computers at a selective university in the United States.