Share app_code between multiple virtual directories

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to share code between several web sites that exist as virtual
directories under a single site. It appears that I have to create an
app_code directory under each virtual root in order to share classes accross
the code in the different virtual directories.

This seems to defeat the purpose of shared code.

Is there any way to specify to IIS where the app_code directory is for a
virtual site?

Thanks for the help
 
I don't think the purpose of app_code is to share code but rather provide a
place where the server monitors for changes and recompiles on the fly.

Just share the code the code old fashion way by creating a separate library
project and giving each virtual root a copy of that assembly.
 
Regardless of the purpose of the app_code directory, my goal is to share code
accross multiple virtual directories. While your approach will probably
work, it seems to me that the concept of inheriting classes and re-usable
code is defeated by the rather strict constraint that code must reside in a
specific directory with no provisions for pointing the application to a
directory that could contain code common to multiple web sites.

Thanks for you help, I will try your approach
 
The purpose of the App_Code directory is for ASP.NET to directly compile
your website (singular) classes together with your ASPX pages for that
website (singular). It is to share classes among your website.

What you want to do requires that you build a common DLL and either deposit
it into your bin directory for each website or put it in the GAC.

This is the purpose of shared code. The question is if you are sharing
within the right context.
 
Back
Top