Skip to content
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
Closed
@davidfowl

Description

@davidfowl

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.

/cc @rynowak @danroth27 @SteveSandersonMS @Eilon

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions