Recommended? probably not. Illegal? maybe. Possible? yes.
You can use virtual directories in the App_Code directory of an ASP.Net file-based website hosted in IIS7.
Create the empty path on disk
First, create a file structure similar to the path below, where "MyWebRoot" is the root directory of your website and "MySharedCode" is the name you want for the virtual directory that will contain the shared *.cs or *.vb source code files.
Mask the physical path with the virtual directory
Next, open the Internet Information Services (IIS) Manager and find your site under the "Sites" node of the server.
Click the plus next to the site name to expand the site. You will see the top level directories listed.
Right-click on the "App_Code" directory and choose "Add Virtual Directory..." (See screenshot)
IIS Virtual Directory Dialog Screenshot
Type the name of your shared code virtual directory into the "Alias" text box. This name must match the name of the empty folder you created in the App_Code directory.
Finally, enter the actual path to the shared code location in the "Physical path" text box.
Click "OK" to finish creating the virtual directory.
The next time you browse the site, IIS should compile the files located in the physical path that your virtual directory references.
NOTE: You may need to reset IIS or "touch" the Web.Config file to kickstart that process.
Start > Run > iisreset
Apparently, IIS gives precedence to the content of the virtual directory but it needs the presence of the physical path to motivate it to compile.