Recently, I was trying to get an existing Episerver website up and running for a client.  After downloading the website from source control, installing the database, when I tried to view the homepage I got this error:

'You do not have permission to view this directory or page'

Looking at the Episerver logs, the only error that was being thrown was:

'EPiServer.Global: 1.2.5 Unhandled exception in ASP.NET'

This error has got to be up there, within one of the most useless, unhelpful errors I've encountered :P If you find yourself a similar situation, read on as I might be able to help ;)

What's Going On?

After a bit of head scratching, I figured out the issues. The site was using the BVN re-direct module. When the plug-in fails it seems like it throws an error, Episerver catches that error an then displays a generic exception message. If your site is using the BVN handler, then this is one of the first areas I recommend that you check out.

In my scenario, I was copying a live database and trying to get it up and running on my PC. As the homepage errored, I logged into the Episerver editor and had a look at what was set within my host definition. If those of you new to Episerver, if you log into the Epsierver Admin -> Config -> Manage Websites. This area is where you define your start page and the hostnames that are allowed to access it.

As I copied the DB from a live site, obviously, this was completely different to the hostname I wanted to use locally. As soon as I deleted all the live site hosts and added my local one in... the site worked and the error disappeared.. enjoy!