Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • jlacis 19 posts 39 karma points
    Dec 11, 2012 @ 12:41
    jlacis
    0

    render image, using controller

    hello everyone.

    I need to set specific location as source for my images in my custom controller(view)

    right now I'm using this code :

     <img id="@item.Company"

                                             style="height: auto; width:auto; max-height: 88px;max-width:88px" alt="@item.Id"

                                             src="@Url.Action("MyImage", "MyController", new { path = item.Path, name = item.ImageName })"/>

     

    and the action in controller :

     [ChildActionOnly]

            public ActionResult MyImage(string path, string name)

            {

                return File(@"" + path, name);

            }

     

    but, it doesn't work.

    where could be the problem?

Please Sign in or register to post replies

Write your reply to:

Draft