3

我正在使用正确的助手调用来获取主题中图像的 URL:

@Url.Content(Html.ThemePath(WorkContext.CurrentTheme, "/Content/Images/my-image.png")

...而且我知道图像在那里并且是可读的。然而,当我尝试浏览它时它没有出现!为什么会这样?

4

1 回答 1

6

从文档(http://docs.orchardproject.net/Documentation/Anatomy-of-a-theme):

要启用文件,每个包含静态文件(如样式表、图像或 JavaScript 代码)的文件夹都应包含一个包含以下内容的 web.config 文件

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.web>
    <httpHandlers>
      <!-- iis6 - for any request in this location,
           return via managed static file handler -->
      <add path="*" verb="*" type="System.Web.StaticFileHandler" />
    </httpHandlers>
  </system.web>
  <system.webServer>
    <handlers accessPolicy="Script,Read">
      <!-- iis7 - for any request to a file exists on disk,
           return it via native http module.
           accessPolicy 'Script' is to allow for a managed 404 page. -->
      <add name="StaticFile" path="*" verb="*" modules="StaticFileModule"
           preCondition="integratedMode" resourceType="File"
           requireAccess="Read" />
    </handlers>
  </system.webServer>
</configuration>
于 2013-01-31T21:57:55.077 回答