views:

1254

answers:

2

Hello All,

I am trying to install an app inside of another web app. I have my .aspx pages and some code that I was putting into the main app's app_code folder. I've added my own web.config file for my connection string and such but I think there's a conflict. So my question is a two parter. First, what is the best way to install an app inside of another app, i.e should I use the main apps app_code folder or add my own, and second, would there be a conflict with the two web.config files. I was under the impression that the files pulled from the most specific web.config file. It appears there is a problem with my security and I am unable to access my file. I was attributing this to the two web.config files,

thanks.

+1  A: 

Regarding your first question, I would rather have them deployed on different folder. And second, if you have, for instance, a web site inside the default web site, you will have both web.config, but the more specific will override some of the attributes of the web.config from the default web site, but the ones that are not override will be there, (ie, HTTPHandlers, HTTPModules, the site will try to load those, so you will need to add the remove tag inside the HttpModules to remove them).

Hope this clarify your question

Quaky
+1  A: 

If the nested application has had its folder turned into an application (right-click on it in IIS, Properties, and on the "Application" tab, "Create" a new application), you should put the code in the local App_Code folder:

- \RootFolder        // Root of website
|-  \App_Code        // App_Code at root
|-  \NewApplication  // Seperate application in IIS, has "web in a box" icon in IIS
| |-  \App_Code      // App_Code of new application

If the nested application isn't a true application (in the IIS sense), then you will need to have the code files in the root App_Code folder.

This also has a bearing on your web.config - if the nested application is a true application, then you'll be able to have a full web.config at the level you want - however if it's not an IIS application, then there are limitations as to what you are able to put in subsequent web.configs - some elements are only allowed in the web.config at the application root, and can't be overridden by other settings.

What's the actual error you are seeing?

Zhaph - Ben Duguid
What if you're using WAP projects. There is no app_code folder! And you should use WAP, website projects suck.
CoffeeAddict
@coffeaddict - That's as maybe, and in general I would use a Web Application Project, but there are valid reasons for using a web site if that suits your style. If you're having this issue with WAP, the same points apply, just replace \app_code with \bin, and put your compiled .dlls in there.
Zhaph - Ben Duguid