One of the pages I’ve been working on uses EPiServers categories a lot. But the annoying part with EPiServers categories is the way they inherit down to all children, which leads to the problem that categories can be deleted without someone meaning too. e.g you create a page called ”Books” and you have a control that creates a category using the pagename. Below ”Books” you’ll add all the books you want, but all those books will get the category ”books” aswell. But to prevent dead categories, you might want to make a check that once you delete a page, you’ll also delete the category. Then, when deleting a childpage, you’ll also delete the real category, since the childpage also had this category. There are of course ways to prevent this but this can easily be forgotten and cause future problems. It will also mess up search results that uses categories to find information and so on.

Enough with examples, let’s get on the easy solution.

EPiServer.DataFactory.Instance.PublishingPage += CreateCategory;

EPiServer.DataFactory.Instance.SavedPage += CreateCategory;

EPiServer.DataFactory.Instance.SavingPage += CreateCategory;

EPiServer.DataFactory.Instance.CreatingPage += CreateCategory;

static void CreateCategory(object sender, EPiServer.PageEventArgs e)


if (!ValidPage(e.Page.PageTypeID))


e.Page.Property["PageCategory"].Value = string.Empty;



Basicly, you’ll call the method ”CreateCategory” whenever you create, save or publish a page. Then use a method to determinate if the pagetypeid of the page you are creating is a validpage (i.e you don’t want these pages to inherit categories) and then just give it a string.Emtpy as PageCategory value.  Whatever the situation, just make a method to check if you want the page to inherit the category or not, then use the code above.

Hope this helps

EPiServer.DataFactory.Instance.PublishingPage += Instance_SavingPage;
EPiServer.DataFactory.Instance.SavedPage += Instance_SavingPage;
EPiServer.DataFactory.Instance.SavingPage += Instance_SavingPage;
EPiServer.DataFactory.Instance.CreatingPage += Instance_SavingPage;

Googlewave invites arrive to those who wait, just like a Christmas gift 😛 But on a serious note. When you have a googlewave account, you eventually get a few invites to give away. I still have 10 to give away so just add a comment here (with your email ofc) and I’ll be sending one your way.

Goolewave to the people! Viva Google! 😛

HTML 5 introduces new elements to use such as <header> <section> <nav> and many more. The problem is that no version of Internet Explorer recognizes the new elements, but Firefox, chrome and many others does. The solution is easy but a bit boring when you think about it, since it’s about replacing all new elements to div instead. Which means that IE users won’t be able to appreciate HTML5 but users that use Firefox, Chrome and so on will.

Anyway, on with the solution! What you need to do is modify the writer and basically find all elements and change them with a div.  A good place to do it on is on your masterpage.

protected override void Render(HtmlTextWriter writer)
if(Request.Browser.Browser == "IE")

private void HTML5Replace(HtmlTextWriter writer)
MemoryStream memoryStream = new MemoryStream();
StreamWriter streamWriter = new StreamWriter(memoryStream);
HtmlTextWriter memoryWriter = new HtmlTextWriter(streamWriter);
memoryStream.Position = 0;
TextReader reader = new StreamReader(memoryStream);
string output = reader.ReadToEnd();
output = Regex.Replace(output, RegExStrings.HTML5_BLOCK_ELEMENTS , RegExStrings.HTML5_BLOCK_ELEMENTS_REPLACEMENT );

But what REALLY does the magic is the RegEx, since it will find the elements for you and replace them correctly.

public const string HTML5_BLOCK_ELEMENTS = @"<(\/)?(nav|section|header|aside|footer)";
public const string HTML5_BLOCK_ELEMENTS_REPLACEMENT = @"<$1div";

The reason why I use $1 on the replacement string, is because I want to add a ”/” if there is one in the element I found. This to close the tag correctly. So basically, when it finds ”<nav” it will replace it with ”<div” and when it finds ”</nav” it will replace it with ”</div”. Closing tag and class/id names will still be there so the div can take on the behavior of the replaced element.

Another problem that you will run into, if you’re running your site with EPiServer that is, is that EPiServers friendlyurlrewriter doesn’t recognize the doctype and it will try to fix it for you. For HTML 5 you’ll need the following doctype  ”<!DOCTYPE html>” but EPiServer will change it to the following ”<!DOCTYPE HTML PUBLIC ”” ””>”. Mohsen Pirouzfar found a great solution for this which you can read here. It’s in swedish but the code itself is usable to anyone 🙂

We’ve had huge problems with the testserver. It first felt like a cache problem, because when you updated the content and hit refresh several times, you saw the changes and then you didn’t. Also, pages that were dependant on session state were giving null expressions since the state was empty sometimes.

The problem was in the Application Pool. DefaultAppPool was for some odd reason by default set to 3 worker processes which makes it a web garden (used for load-balancing) and this caused the user to get the errors mentioned above, since only one of the worker process actually had a valid session, the others didn’t.


After upgrading EPiServer CMS5 r2 to CMS5 r2sp2 you might get a nice little error in edit mode. This page is not available for the active language. This is due globalization changes and the workaround is to activate a language for your site. To do this do the following:

1. Go to admin mode
2. Click on Config
3. Go to systemsettings
4. Activate Globalization
5. Go to Edit mode
6. click on Language Settings
7. Chose the default language
8. Go back to admin mode
9. Turn off globalization

This should do the trick. Remeber, if you have several sites, you need to click on the root of each one of them and set the language settings on all of them.

I’ve been working with VMWare running WinXP for a year now but now it’s feeling a bit too slow so I’ve decided to run vista native on my macbook pro.  (will upgrade to vista7 later on).

First problem was that Boot Camp assistant couldn’t create a partition for windows since it couldn’t move some of the files. The ”best” solution seems to be to run time machine and recover. That way it will defrag the harddrive and let you create the partition.

Second problem was the drivers. I’ve installed Vista SP2 and boot camp2.0 didn’t really work as intended. Neither the trackpad nor fn button was working properly, so I had to install 2.1 as soon as possible. Problem is that the installation just pops up and nothing happens.

I’ve runned into two solutions for this problem.


Try the following:

1) run: regedit.exe

2) search for: Boot Camp Services
the key should be: ProductName

3) change in the same path, the Language key to: 1033

4) run the installer again

I didn’t really try this one out at though but most people say it works.

Second way:

Change your region to English(US)
Uninstall Boot camp 2.0
Install Boot camp 2.0
Install Boot camp 2.1

Yes, it’s annoying. Yes, it takes time. But now it’s done and finally I’m running Boot camp 2.1. (restarting as I’m typing this). Just hope that trackpad and fn key will work now 😛

Using EPiServers softlink can really come in handy in different situations.  Mostly of course when you need to gather information from the linked pages of a document.

Here’s an example on how to use this:

Example in VB.Net

Dim f As EPiServer.Web.Hosting.UnifiedFile = TryCast(System.Web.Hosting.HostingEnvironment.VirtualPathProvider.GetFile(filename), EPiServer.Web.Hosting.UnifiedFile)

Dim filecollection As EPiServer.DataAbstraction.SoftLinkCollection = EPiServer.DataAbstraction.SoftLink.Load(f)

For Each file As EPiServer.DataAbstraction.SoftLink In filecollection
Dim ref As New PageReference
ref = file.OwnerPageLink
'now you can work your magic

Example in C#:

EPiServer.Web.Hosting.UnifiedFile f = System.Web.Hosting.HostingEnvironment.VirtualPathProvider.GetFile(filename) as EPiServer.Web.Hosting.UnifiedFile;

EPiServer.DataAbstraction.SoftLinkCollection filecollection = EPiServer.DataAbstraction.SoftLink.Load(f);

foreach (EPiServer.DataAbstraction.SoftLink file in filecollection) {
PageReference ref = new PageReference();
ref = file.OwnerPageLink;
//now you can work your magic

So what you need to do is pretty much to load up the file reference into a softlink and fill a softlinkcollection with that. Then just run a for each on the collection (since a document can have several linking pages). Once you get your reference, you can just do a getpage on the ref and grab whatever you need from the linking page.

One of our customers found a little annoying bug when publishing news to their page.

The bug goes as following:

News page type contains a few categories as well as an extra date field to point out the news date (in case you don’t want to use the publishing date and want to use your own) and it’s required as well.

You forget to fill out the news date,  but fill everything else up, including choosing which categories the news should belong too and then hit Save and Publish.

EPiServer will do a postback and warn you about not filling in the news date. If you at this moment check the categories, you’ll see that they are still clicked in, you fill in the date and hit save and publish once more.

The news will be posted but without the categories as EPiServer will lose the values on the postback but still show them as checked.

This is a verified bug from EPiServer and hopefully to be fixed in an upcoming version.

NBC and youtube aint best friends, that’s no suprise. After Youtube posted some NBC videos they deleted their youtube channels and you will find it hard to find any NBC videos on youtube. Quite a shame since its free commercial for NBC but that’s not the point with this post.

Have you watch ”Dick in a box”? if not, then click here and go watch it first. Justin and Adam went and made a second video and this one is as funny as it gets 🙂 Only problem is that it’s quite hard to find a watchable video since NBC is killing it on youtube and their site requires you to be a US citizen. But Sevenload has saved the day. So enjoy!

Link: Mother Lover Justin Timberlake-Saturday Night Live