-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add StaticFileResult #6260
Comments
I don't understand how this is different from https://github.com/aspnet/Mvc/blob/dev/src/Microsoft.AspNetCore.Mvc.Core/ControllerBase.cs#L1201 Is this mostly about the mime-type mapping? |
@rynowak yes, whatever the static file middleware does when it gets a file, this needs to do as well. Maybe it's just mime mapping but I haven't looked to see if that is the only delta. |
We should find a way to expose and reuse that then. We don't have an O/L without a content type so it's something we could add. |
Basically some of the in here (if not all) https://github.com/aspnet/StaticFiles/blob/d6c2834f95d69dfbb5a9cdd6bc54a1d510d27e4a/src/Microsoft.AspNetCore.StaticFiles/StaticFileContext.cs should be in this component. |
Sounds good to me. At first I thought it might not be necessary since applications can just combine |
@jbagga is adding a lot of the missing functionality in #6150 (Ranges, conditionals, etc.).. The mime type lookup is one of the few missing pieces. The lookup is less critical from MVC, you're manually specifying the file name so you likely already know the mime type, it's not dynamic like it is for StaticFiles. |
Aside from Example: |
@sebastienros That's already available through FileDownloadName.
|
@Tratcher great, and |
Yes,
|
We've moved this issue to the Backlog milestone. This means that it is not going to happen for the coming release. We will reassess the backlog following the current release and consider this item at that time. However, keep in mind that there are many other high priority features with which it will be competing for resources. |
Closing this as it seems most of this work has been done:
|
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.
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
The text was updated successfully, but these errors were encountered: