Solved

Sharing App_Code between different web Applications

Posted on 2007-03-20
3
1,308 Views
Last Modified: 2007-12-19
Hey,

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
0
Comment
Question by:ukwebguy
3 Comments
 
LVL 37

Accepted Solution

by:
samtran0331 earned 300 total points
ID: 18755999
>>The path '/App_Code/' maps to a directory outside this application, which is not supported.

I don't think you'll get around this, "App_Code" is a special folder that the Framework recognizes and handles a specific way.

>>We are aware of the DLL route, but would like to avoid this if possible.

In my opinion, the DLL route is ideal, why are you trying to avoid it?
If your solution in Visual Studio was set up:
-MainSolution
---SharedCode (Class application)
---Website1
---Website2
---WebsiteEtc

SharedCode would be a class application that inherits from system.web (which would give you access to everything to everything in the web namespace)
And all your websites reference SharedCode.
When you compile/publish, the DLL will get dropped in each website's \bin.

This is (in my opinion) the ideal way to share code...and other routes will probably cause more problems that it solves...
0
 
LVL 35

Assisted Solution

by:mrichmon
mrichmon earned 200 total points
ID: 18756783
All ASP.NET folders App_Code, App_Data, etc are special folders that have different permissions and restrictions than normal folders.  They are specifically treated as outside of the application so that you can have things like your database located in your App_Data folder and know it is safe from external browsing.

You have two choices for shared code.

One is the dll - I agree with samtran0331 that this is not a bad way to go at all.

Another is to expose anything you need as a web service - which is probably more hassle than you want.
0
 
LVL 1

Author Comment

by:ukwebguy
ID: 18757201
Thanks guys,

We suspected that this would be the only real solution.  I think we were trying to use classic ASP techniques in an ASP.NET environment.

Thanks guys.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
HTML table 7 54
Put text in a picture ASP.NET C# 2 36
Problem to go to Web page 2 48
ASP.net VB.net Email  a webpage 3 24
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now