Search code examples
model-view-controllercontrollerresolveurl

new control().ResolveUrl("") not working on deployed


I have an application using MVC. In my controller I have their a viewdata[] which contains the image path (Viewdata["dd"]=new Control().ResolveUrl(path)). This will work on my local but on the deploy it will not work anymore.

Anybody have experience this scenario?

Your reply is greatly appreciated.

Best


Solution

  • Why not use this:

    Controller:

    ViewData["dd"] = path;
    

    View:

    <img src='<%= Url.Content((string)ViewData["dd"])%>' alt="" />