0

With MVC3, I have a controller that returns a FileContentResult, which is a JPEG. I can call this and it displays the JPEG perfectly in the browser. I would like to display this multiple times on the page and the only reasonable way I can think of is using calling Html.RenderAction() multiple times within a view. This works for action methods that return ViewResult but not for this one that returns FileContentResult.

Error is Compiler Error Message: CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments

What am I doing wrong?

Many thanks

Bobbler
  • 633
  • 1
  • 7
  • 21

2 Answers2

0

It seems to me that you should use the img tag multiple times and point the URL to some CDN.

McGarnagle
  • 101,349
  • 31
  • 229
  • 260
0

Html.RenderAction is a void method, iirc, so it needs to be called like:

@{Html.RenderAction(..);}

or

<% Html.RenderAction(...); %> 

if you're using webforms

Daniel
  • 622
  • 4
  • 6