Retrieving image location in Orchard CMS using asp.net MVC
Asked Answered
C

1

7

I am using Orchard MVC to one of my project. I was trying to create custom module. I don't find any problem in that. But when I tried to put image in view page, I am facing problem. I don't know if problem is of Routing or Orchard it self.

First thing module has "dot" in its name like Orchard. so, if I am trying to giving path from Modules/Orchard.Name/Style/Images/1.jpg it has . in between which I guess not true. And if I trying to access like this ../../../Style/Images/1.jpg in final url it has http://localhost/style/Images/1.jpg which is not the path of Image.

How to access url of image. Do I have to define custom routes to access? Or is there any other workaround?

Chloras answered 7/2, 2012 at 19:11 Comment(1)
#5694294Subdeacon
B
5

All you have to do is look at one of a bazillion examples in the code ;) Such as this:

<img class="icon" src="@Href("~/Modules/Orchard.Users/Content/Admin/images/online.gif") " alt="@T("Approved") " title="@T("User is approved") " />
Badderlocks answered 7/2, 2012 at 23:57 Comment(2)
You will also need a web.config file in your Content folder. Copy the web.config from Orchard.Users/Content.Rawley
Sometimes only the Theme/app/Content is shared, so try to move images there.Liverwort

© 2022 - 2024 — McMap. All rights reserved.