开发者

Asp.Net MVC controller action returning animated gif issue

开发者 https://www.devze.com 2023-04-04 00:44 出处:网络
I have a situation where I want to return an animated gif from an ASP.Net MVC controller action. I then want to construct an anchor tag like this:

I have a situation where I want to return an animated gif from an ASP.Net MVC controller action. I then want to construct an anchor tag like this:

<img src="/MyController/MyAction" id="company-logo" alt="Company Logo" />

The 开发者_运维百科idea is that I want to be able to allow users to upload their own company logo and the controller action should retrieve their specific logo from the server.

However since my src attribute value does not end with .gif, the browser does not seem to be recognizing it as a gif and therefore does not animate it.

I know the controller action is returning it as a gif because when i load it from file I give it the file format as gif.

Does anyone have any suggestions as to how to go about getting my desired functionality?


The file extension would have nothing to do with it at all. Perhaps you need to make sure that your controller is setting the correct MIME type to image/gif? The browser can 'guess' at the content type sometimes, but it may not animate a gif in such a circumstance.

0

精彩评论

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