K
K
karcendror2022-02-20 15:08:00
ASP.NET
karcendror, 2022-02-20 15:08:00

How to link to an html page in ASP.Net?

How to link to a link html page in ASP.Net. Tried this method

void home(IApplicationBuilder appBuilder)
{
appBuilder.Run(async context => await context.Response.SendFileAsync("wwwroot/index.html"));
}
and announced. using app.Map("/Home" , home);.
As a result, auxiliary files (styles and scripts) do not work.
How can I do it without detailed problems?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Korotenko, 2022-02-20
@firedragon

just add addStaticFiles();
and put the file in wwwroot/index.html

V
Vasily Bannikov, 2022-02-20
@vabka

As a result, auxiliary files (styles and scripts) do not work.

Well, they also need to be given - the browser also makes an http request to receive them.
To handle all static files, there is
app.UseStaticFiles();
https://docs.microsoft.com/en-us/aspnet/core/funda...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question