Sub Application - Shared SQL Connection with Parent

Topics: Business Logic Layer
Jun 10, 2009 at 3:51 PM

I recently integrated BE with my 3.5 web application and it worked flawlessly.  I'm now setting up Membership on my parent site and would love for those Roles/Members to "propogate" to the Sub BE application.

I know I can go in to the web.config of BE and change the connection string and get it talking to my SQL (which has had the aspnew_regsql.exe run on against it).

My question is:  can I share the connection string info in the Web.Config of the parent site with BE.  Reason being, I have to change the web.config's based on what environment I'm deploying my project to, and having the exact same connection string in two places that then needs to be updated seems cumbersome.

Have I explained myself clearly?  Hope someone has some thoughts.

Jun 10, 2009 at 5:12 PM

If you have two web.config files then that leads me to believe that you have two different virtual directories. Since they are considered different applications, there is no way to inherit it.

That being said. I think there were a decent amount of articles floating around about making your BlogEngine.NET blog a subdirectory of your main site. This I would imagine would have to require web.config in ~/ and merging the two web.config files. Then installing the BlogEngine stuff into a subdirectory (like ~/blog/). Then stuff inside BlogEngine.NET/bin/ would have to be deployed to ~/bin/ and not ~/blog/bin and similarly with ~/App_Code files. Hopefully I am explaining this right.

I have never had BE as a sub directory of a parent application, but I have made 4 other web applications a sub application of BE using the same theoretical methodology.

I hope this helps.