Design and CSS styles
Version 7.x > Design and CSS styles > CSS images in App_Themes View modes: 
User avatar
Member
Member
SLorenz - 1/14/2014 6:11:04 AM
   
CSS images in App_Themes
Hi,

I followed the ASPX tutorial and added a custom CSS style (assigned it to the site, copied files into App_Themes/<CSSCodeName>/Images.

CSS images are referenced this way:

background-image: url(/App_Themes/KplusDesktop/Images/logo.gif)

where "KplusDesktop" is the code name of my CSS style.

Unfortunately I don't see an image in the browser. I doublechecked everything (path's casing is right) but can't find the error. Trying to access the image directly from the browser (path taken from Firebug) results in a 401.1 ("Not authorized: Access denied due invalid login").

From the error message I would guess the problem is related to IIS or ASP.NET configuration, but I don't have a clue where to start. Also I've read that App_Themes folder is a special folder in IIS/ASP.NET, so maybe the error is normal. My machine is a default setup (Server 2012, IIS 8, .NET 4.5) and the site is an almost unmodified new site.

Anyone has a good advice?

Thanks in advance

S. Lorenz

User avatar
Member
Member
kentico_sandroj - 1/14/2014 11:38:42 AM
   
RE:CSS images in App_Themes
Hello,

This sounds like an issue outside of Kentico, specifically with authentication. If you navigate to IIS > Select the site > Authentication, is Windows Authentication enabled? If so, please try to disable it temporarily to see if that the case.

See also additional suggestions (location attribute).

Please let me know if you have any questions.

Best Regards,
Sandro Jankovic

User avatar
Kentico Legend
Kentico Legend
Brenden Kehren - 1/14/2014 1:01:54 PM
   
RE:CSS images in App_Themes
Aside from fixing the authentication, I'd move away from using the tilde (~) in your style sheet because it's not a standard in CSS, that's an asp.net standard with server controls. Use url(../../App_Themes/<code>/images/image.png). You can also try url(images/image.png) but I've had the best luck with the first one.

User avatar
Member
Member
SLorenz - 1/15/2014 1:55:21 AM
   
RE:CSS images in App_Themes
The additional suggestions didn't work either (good find, btw. I googled before but this article didn't came up), but the thread linked to the solution: I just needed to give IUSR read rights on the folder.

That fixed it!

Thank you both for your quick help!

Stefan