Well I've been doing loads of pre-sales recently which has kept me off the development track - a necessary evil really. Thought I'd share a quick learning with you about a problem that sometimes happens with the Admin CSS in EPiServer.

On a project I'm doing alongside my colleagues, they set up EPiServer on a virtual directory on their default website, e.g. localhost/clientname/default.aspx. I was set up on the root a different site (but lets just say it was the default website, it doesnt matter), e.g. localhost/default.aspx.

I decided to change my project structure to match theirs, especially as the web.config referred to the root path which was different for me. Might as well be consistent. So I moved my EPiServer site into a virtual directory, grabbed a copy of their web.config and everything worked fine.

Almost.

I could log in fine to the admin site, but suddenly all my frames were weird sizes, my fonts were messed up and obviously a css was being missed somewhere. I had a look and it was System.css, and strangely that didn't even exist in the path it was looking!

Turns out I had forgotten to do something... set my 404 handler. For some reason the EPiServer devs decided to route System.css to System_template.css via the custom 404 handler. Well I set the 404 handler to the correct path and now it works fine.

Hope this helps someone!


Bookmark with :
Digg It! DZone StumbleUpon Technorati Reddit Del.icio.us Newsvine Furl Blinklist
posted @ Tuesday, August 14, 2007 4:04 PM | in .NET/C# EPiServer

Comments

Gravatar
# re: Admin CSS in EPiServer
Posted by Steve Celius
on 8/14/2007 6:21 PM
The reason for this is to handle the case where people move sites around :-)

If you look in the system_template.css file, you can see lines like this:
background-image:url($RootDir$Util/images/titleBarBackground.gif);

Obviously, this is not valid css. When you enable the 404 handler EPiServer get a chance to rewrite the contents of the file, replacing the $RootDir$ with the actual value from the web.config file.

Actually, the 404 handler is not the one doing the work, but because it is an .aspx file, the http modules get in on the fun. The magic happens in the SpiderSupport http module.

It only support $rootdir$ and $uploaddir$, but it does so on both .css files and .js files. And the good thing, you can use this technique on your own files too.
Gravatar
# re: Admin CSS in EPiServer
Posted by Dan Matthews
on 8/15/2007 10:28 AM
Thanks for the info Steve - very useful! I guessed there was method to the madness :D

Dan
Gravatar
# re: Admin CSS in EPiServer
Posted by
on 2/25/2008 4:13 PM
lol

Post Comment

Title *
Name *
Email
Url
Comment *  


Please add 7 and 7 and type the answer here: