使用 asp.net MVC 检索 Orchard CMS 中的图像位置

发布于 2025-01-02 23:23:50 字数 419 浏览 1 评论 0原文

我正在我的一个项目中使用 Orchard MVC。我试图创建自定义模块。我不认为这有什么问题。但是当我尝试将图像放入视图页面时,我遇到了问题。我不知道是路由问题还是果园本身的问题。

首先,模块的名称中带有“点”,如 Orchard。所以,如果我试图给出 Modules/Orchard.Name/Style/Images/1.jpg 的路径,它有 .在这之间我猜不是真的。如果我尝试像这样访问最终网址中的 ../../../Style/Images/1.jpg 它有 http://localhost/style/Images/1.jpg 这不是图像的路径。

如何访问图片的url。我是否必须定义自定义路由才能访问?或者还有其他解决方法吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

方圜几里 2025-01-09 23:23:50

您所要做的就是查看代码中无数示例之一;)例如:

<img class="icon" src="@Href("~/Modules/Orchard.Users/Content/Admin/images/online.gif") " alt="@T("Approved") " title="@T("User is approved") " />

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") " />
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文