asp.net mvc return actionresult for video
What action result should I use when I am trying to return an mp4 video using asp.net mvc csharp?
Currently, I hide my videos behind a method to protect it from unauthorized access. I call these videos fr开发者_高级运维om JWPlayer in a web browser. However, the header information seems to be missing or the video is prepared for download and not for playing. Something strange, anyways.
How should I return the file? Should I specify additional headers?
This is what I currently do:
return File(path, file.MimeType, fileName);
Create a custom ActionResult.
Here is an example for images I used to create one for pdf, the concept should be the same for any file type.
精彩评论