Image path in theme

Topics: Themes
Mar 2, 2010 at 8:22 AM

Hi Guys,

So I have designed a new theme and have an image in my new theme folder.

In the site.master page I can only get the image to display if I use the non URL rewritten path:

So this works:
http://localhost:1814/BlogEngine.NET/themes/myTheme/images/logo.gif (works)

Why will the URL rewriting not handle the theme? Surely I should be able to reference the image url like this:
http://localhost:1814/BlogEngine.NET/images/logo.gif (does not work)


Mar 3, 2010 at 12:15 AM

The URL rewriting that is included in BE rewrites URLs for Posts and other items, but not for images.  Oftentimes .NET doesn't even get the request for images when using IIS6 or possibly IIS7 also in some cases, since IIS doesn't pass the image requests on to .NET.  IIS just handles serving the images itself.

When creating images, just make sure you use a SRC that resolves correctly from any subfolder.  For example:

<img runat="server" src="~/themes/myTheme/images/logo.gif"/>
<img src="<%= Utils.RelativeWebRoot %>pics/logo.gif" />
<img src="/BlogEngine.NET/pics/logo.gif" />
<img src="/BlogEngine.NET/themes/myTheme/images/logo.gif" />