403 errors when referencing theme assets from HTML
Hello,
<
img
src
=
"/MyProject/App_Data/Sitefinity/WebsiteTemplates/MyTemplate/App_Themes/MyTheme/Images/logo.png"
alt
=
"logo"
/>
Hello Klemen Slavič,
Thank you for using our services.
The App_Data folder is a special folder in ASP.NET with special permissions. Its purpose is to serve as data store (mainly for db files and xml schemas). It is protected from direct linking and probably this is why you are experiencing problems when try references images in App_Data. Can you try copying the images in some other path and linking them?
Kind regards,
Radoslav Georgiev
the Telerik team
I see, I've been mislead by the 4.0 beta documentation. Quote:
Example: Including a Reset.css file for a theme as a link.
<
link
href
=
"~/App_Data/Sitefinity/WebsiteTemplates/DefaultTemplate/DefaultTheme/Global/Reset.css"
type
=
"text/css"
rel
=
"stylesheet"
/>
It works now, but the documentation should be updated to reflect this restriction.
Hello Klemen Slavič,
Thank you for getting back to me.
The css files are served because you have registered the theme and Sitefinity is rerouting the paths not to be pointing to App_Data. If you examine the locations of the loaded CSS files on your page they will be something like: /Sitefinity/WebsiteTemplates/University/App_Themes/LightGreen/global/main.css. Also images contained in your theme's css are also rerouted and loaded without the App_Data in the path. So you should be able to link to the image with:
<
img
src
=
"/MyProject/Sitefinity/WebsiteTemplates/MyTemplate/App_Themes/MyTheme/Images/logo.png"
alt
=
"logo"
/>
Yes, that did the trick. Thank you.