Re: Inherited web.config ASP.NET 2.0

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



re:
Juan, did you get the same results as Ben?

Hi, Steven.

My results are similar to yours for unconfigured directories down the tree.

I assumed that "inetpub\wwwroot\group1\site1" and the other two sites
( site2 and site3 ) were configured as separate applications.

Hence, the comment that they wouldn't inherit from /group1.

I stand by :
"Root web.config settings are inherited, unless they are overturned
by a different setting in a web.config down the directory tree."

And regret any confusion stemming from :
"If you place a setting in inetpub\wwwroot\group1\web.config,
the setting will be local to the \group1 directory, but the
subdirectories below it will inherit from the root directory."

What I meant to write was :
"If you place a setting in inetpub\wwwroot\group1\web.config,
the setting will be local to the \group1 directory, but the
subdirectories below it will inherit from their application's root directory."
( working on the assumption that the subdirectories are separate apps,
therefore they each have separate application roots, so they would *not*
inherit from a directory placed higher than them in the directory tree)




Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Steven Cheng[MSFT]" <stcheng@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:c3jOIhDvGHA.5696@xxxxxxxxxxxxxxxxxxxxxxxx
Hi Ben,

Thanks for the reply and thanks for Juan's inputs.

I don't think there is any difference between your test site and my local
test site's structure.

Juan, did you get the same results as Ben? I've tested this on my local
environment and web.config file inheritance does work as long as the
web.config is put in the parent folder that is in the folder path (to the
leaf application node).

I've attached a screenshot of my local test site's folder structure (in the
default IIS site):

The directory sturecture is

Default Site/
ASPNET/
V2/
WebSites/
.....web applications

Except the "Root Default Site" and the leaf web applications, all the other
directory in the hierarchy are normal virtual directory. I've put
web.config files(only contains some <appSetting> keys) in the following
directories:

*Default Site(root)

*V2

*WebSites

And in the web applications under "Websites", I can use the following code
to get all the appSetting keys defined in all the web.config files above:

=====================
protected void Page_Load(object sender, EventArgs e)
{
foreach (string key in WebConfigurationManager.AppSettings.Keys)
{
Response.Write("<br/>"+ key + ": " +
WebConfigurationManager.AppSettings[key]);
}
}
=====================

#Note, I haven't used any external mapped phyiscal directory for the above
virtual directories, they're all under the inetput/wwwroot. So the physical
direcotry structure is as below:

wwwroot\ASPNET\V2\WebSites\xxxweb applications dirs...

Is there anything different from your test applications? I'm using windows
2003 server/IIS6, ASP.NET 2.0

Please feel free to let me know if there is anything else you wonder or can
help you on this.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.


.



Relevant Pages

  • Re: .NET 1.1 Virtual Directory in a .NET 2.0 Website
    ... John Timney (MVP) ... I expected to be able to inherit settings. ... I thought I was supposed to be able to have a 1.1 virtual directory ... IIS webs will always inherit from the root node. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: .NET 1.1 Virtual Directory in a .NET 2.0 Website
    ... I expected to be able to inherit settings. ... IIS webs will always inherit from the root node. ... I have an ASP 1.1 website being hosted in a virtual directory that is a child node of an ASP 2.0 ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Adding httpModules problems
    ... > When we defined this section in web.config in the main root, ... > The problems seems to occur when child application are trying to inherit the ... > settings and load the dll but are looking for it in the local bin folders. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: objects? we dont need no stinking objects!
    ... Surely for option 2 you just inherit from the main contact Object and ... objects was that you COULD go change/refactor/redesign a lower level ... add a new feature or change the aspects of the root object. ... Example of putting an update method in the wrong place: ...
    (comp.databases.pick)
  • Re: Firing events from multiple threads
    ... I am now making good progress on this issue. ... expose the same class library to COM because some applications I need to ... >> This looks like a good suggestion. ... >> inherit from System.Windows.Forms.Control? ...
    (microsoft.public.dotnet.languages.vb)