I have an index.html file stored in the wwwroot folder but I want to access it from view or controller outside any way by using redirect from controller or view.
How to render index.html file that is in wwwroot folder using controller or view in ASP.NET Core MVC
-
Follow any tutorial. You probably don't know whats going on.daremachine– daremachine2022-09-01 13:38:33 +00:00Commented Sep 1, 2022 at 13:38
Add a comment
|
2 Answers
You just have to add the line app.UseDefaultFiles(); in startup.cs in Configure method.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
app.UseHttpsRedirection();
app.UseDefaultFiles(); // this line of code.
app.UseStaticFiles();
app.UseCookiePolicy();
app.UseMvc();
}