This repository was archived by the owner on Dec 14, 2018. It is now read-only.
This repository was archived by the owner on Dec 14, 2018. It is now read-only.
Add StaticFileResult #6260
Closed
Description
If I want to return a static file from an MVC controller action, I basically need to replicate some of the logic of the static file server. To make this easier, it would be great if there was a static file result that rendered content from the web root.
public class MyController : Controller
{
[HttpGet("/")]
[Authorize]
public IActionResult Get()
{
return StaticFile("index.htm");
}
}
In the above example I'm using MVC for auth but the action result for auth'd users renders the index file.