Using MVC request image path by Controlller Action throwing

Posted by Community Admin on 04-Aug-2018 20:45

Using MVC request image path by Controlller Action throwing 404 calling from a different View

All Replies

Posted by Community Admin on 29-Jun-2015 00:00

HI,

Using MVC request image path by Controlller Action throwing 404 calling from a different View and it works fine if I try with browser address bar. User browser developer tool I also noticed that, the request path got change and it looks like as follows and throwing a 404.

 "NetworkError: 404 Not Found - localhost:1929/.../Themes

I'm not sure why request went through Sitefinity/Themes.

Here is my controller code:

public class UtilityController : Controller
   
        public ActionResult Index()
                    
            return Json("");
       

        public ActionResult ResizeImage(string imageFilePath)
       
            //here is the simple code for testing
            Image resizedImage = resizedImage = Image.FromFile(imageFilePath);
            MemoryStream ms = new MemoryStream();
            resizedImage.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
            return File(ms.ToArray(), "image/jpeg");
       

Here is my View code:

<img src="@Url.Action("resizeimage", "Utility" , new imagefilepath="~/poi_fdrsunshinespecial.jpg" )" />​

If I call directly using web browser then it works fine:

localhost:1929/.../poi_fdrsunshinespecial.jpg

Any help is very appreciated.

Thanks.

 

 

 

 

Posted by Community Admin on 02-Jul-2015 00:00

Hello Uttam,

The issue you are experiencing seems to be related to a bug which we have logged in our portal on the following link:

http://feedback.telerik.com/Project/153/Feedback/Details/130166-returning-fileresult-in-an-mvc-action-does-not-work

Fortunately, the issue has been fixed in Sitefinity version 7.1.5213. So, What I can suggest is to upgrade your Sitefinity project to the latest internal build for Sitefinity 7.1 or the best option will be to upgrade directly to the latest Sitefinity version (8.0) in order to resolve the issue and get advantage of other fixes included in this release. You may refer to our upgrade documentation for more details about the supported upgrade procedure.

Regards,
Sabrie Nedzhip
Telerik

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

This thread is closed