Sharing App_Code between different web Applications
Posted on 2007-03-20
We have a very large ASP and ASP.NET Application. The application is predominently ASP but new parts of it are being developed in .NET. In the application there are ASP security pages stored in /system/security which are included in every ASP page. When we first moved over to .NET we re-wrote the various security pages into various VB.NET security classes which are inherited onto each .NET page, ensuring that security is applicable to both ASP pages and ASP.NET pages. This all works fine.
The problem arises that although there is one big application, there are also smaller applications inside it. In IIS there is a main website that links to the root of the application. There are also other websites that link to directories inside the application such as: /subapplications/subapp1/. These sub applications have virtual directories that link to the /system/security directory of the main application (so we can still use the security from the main application).
The problem is that we are now starting to write .NET pages in our sub applications. We started by creating a virtual directory in the sub application IIS website called App_Code, which (we thought) would enable this IIS website to see our classes. However we were just given this error message:
The path '/App_Code/' maps to a directory outside this application, which is not supported.
Further investigation shows that maybe we need to set the sub application to use the AppDomain of the larger application, but we haven't really pushed this.
We are aware of the DLL route, but would like to avoid this if possible. However suggestions of this type would be appreciated. We also understand that the two applications should not be nested, however at this moment in time, it is imperative that they are.
Many thanks for the help