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, I tried to launch the site locally. Unfortunately, when I tried to view the homepage this error was thrown:
'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'
The descriptiveness of this error is not very helpful, what does it mean?!? If you find yourself in 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 issue. The site was using the BVN re-direct module. When the plug-in encounters issues when launching it throws an error, Episerver catches that error and then displays that 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 database from a live server in order to get it up and running on my PC. I logged into the Episerver editor and had a look within the host definitions
screen. you can find this screen by logging into the editor then going here:
Episerver Admin
➡ Config
➡ Manage Websites
This screen is where you define the website's start page and the hostnames that are allowed to access it. As I copied the DB from a live site, the hostname was wrong. It was still using the live website's hostname, rather than the name that I wanted to use locally. As soon as I deleted all the live site hostname and added my local one in... the site worked and the error disappeared. Hopefully, this advice will have fixed your site. If you still have issues, maybe try reading this tutorial, happy coding!