I have a small website that I am building using ASP.NET web pages Razor Syntax. It has an SQL CE 4 database in the App_Data folder. The connection and getting records from the database works fine in pages that are in the root directory and the /Account subdirectory. However when trying to get data from the database in pages that are in other subdirectories, connection to the database does not work. I get an error: Connection string "Database.sdf" was not found.
It is using the connection string from the Web.config file in the root directory:
When I tried copying the root Web.config to the subdirectory I get the following error:
The entry 'Database' has already been added. (C:\Users\Name\Documents\Visual Studio 2010\WebSites\SmallWebsite\subdir\web.config line 11).
At the moment I'm stumped and can't seem to find an answer either in msdn or google. Any help greatly appreciated.
Thanks nl