开发者

asp.net mvc return actionresult for video

开发者 https://www.devze.com 2023-03-12 19:25 出处:网络
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 vide

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消