473,574 Members | 3,033 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Inherited web.config ASP.NET 2.0

Ben
I have a group of settings that I'd like to have inherited by multiple
sites.

I'm trying this, but it's not working.

wwwroot\group\w eb.config
wwwroot\group\s ite1\web.config
wwwroot\group\s ite2\web.config

Where site1 & site2 are applications.

I have tried making group a subweb, an application and a subweb and
application. No matter what, site1 and site2 don't see the settings from
the group\web.confi g.

The funny thing is if I make my changes to wwwroot\web.con fig then site1 &
site2 see the changes. There is of course a catch, the changes are 2.0 and
the server is still running 1.1 sites so the 2.0 settings in the
wwwroot\web.con fig break all of the 1.1 sites :(

I'm open to any suggestions, thanks!

Ben
Jul 24 '06 #1
12 4730
Hello Ben,

Welcome to the ASP.NET newsgroup.

From your description, you have hosted multiple ASP.NET 2.0 and 1.1 web
applications under a IIS website. And those ASP.NET 2.0 web applications
are under the same parent directory in the IIS virtual path. currently
you're trying to store some shared configuration info in the web.config
file within the parent directory of those ASP.NET 2.0 applications so that
they can automatically inherits the setting from them, correct?

Based on my understanding, such inheritance is naturally supported in
ASP.NET application(bot h 1.1 and 2.0). And the following MSDN document
describe the general rules of such configuration inheritance:

#ASP.NET Configuration File Hierarchy and Inheritance
http://msdn2.microsoft.com/en-us/library/ms178685.aspx

For your scenario, I think the problem may caused by the following things:

1. How are all the directories(fro m the IIS site root to the sub
application) created, through a physical sub directory or a mapped external
physical path? e.g. in your case, the complete path is "wwwroot\group\ siteX"

Then, is the "group" directory a physical sub directory of "wwwroot"(s ite
root)? I've performed some local tests, and if the "group" folder is a
physical sub directory(not necessarily an application virtual directory),
the web.config setting in it will be inherited by any sub ASP.NET
applications under it(not matter through physical sub directory or a mapped
virtual directory poinetd to an external physical path).

2. What's the configuration sections are you going to share in the parent
web.config file? My local test use the "<connectionStr ingssection as the
one to be inherited and it works well. Are you going to share the same
setting or any paricular configuration setting?

Anyway, please feel free to let me know if there is anything I've missed or
if there is any particular concerns in your scenario.

Looking forward to your update.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

=============== =============== =============== =====

Get notification to my posts through email? Please refer to

http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial

response from the community or a Microsoft Support Engineer within 1
business day is

acceptable. Please note that each follow up response may take approximately
2 business days

as the support professional working with you may need further investigation
to reach the

most efficient resolution. The offering is not appropriate for situations
that require

urgent, real-time or phone-based interactions or complex project analysis
and dump analysis

issues. Issues of this nature are best handled working with a dedicated
Microsoft Support

Engineer by contacting Microsoft Customer Support Services (CSS) at

http://msdn.microsoft.com/subscripti...t/default.aspx.

=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.


Jul 25 '06 #2
Hello Ben,

How are you doing on this issue? Have you got any progress or still meet
any difficulties on this issue? If there is anything else we can help,
please feel free to let me know.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 27 '06 #3
Ben
Steven,

Thanks for your reply. I haven't had any luck with this. The only way the
settings (connection strings) are inherited is if they are in the root of
the site.

inetpub\wwwroot \web.config - main
inetpub\wwwroot \group1\web.con fig - shared
inetpub\wwwroot \group1\site1
inetpub\wwwroot \group1\site2
inetpub\wwwroot \group1\site3

With the file structure above, if I put a connection string in the main
config file, site1, site2 and site3 see the connection string. If I remove
the connection string from the main config and place it in the shared
config, none of the sites see the setting.

Is what I'm doing something that should be working? I thought so, but it
isn't.

Thanks,
Ben

"Steven Cheng[MSFT]" <st*****@online .microsoft.comw rote in message
news:qu******** ******@TK2MSFTN GXA01.phx.gbl.. .
Hello Ben,

How are you doing on this issue? Have you got any progress or still meet
any difficulties on this issue? If there is anything else we can help,
please feel free to let me know.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no
rights.

Aug 9 '06 #4
re:
With the file structure above, if I put a connection string in the main config file, site1, site2
and site3 see the connection string. If I remove the connection string from the main config and
place it in the shared config, none of the sites see the setting.
Is what I'm doing something that should be working?
No.

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

If you place a setting in inetpub\wwwroot \group1\web.con fig,
the setting will be local to the \group1 directory, but the
subdirectories below it will inherit from the root directory.

The reason for that is that \group1 is not an application.

If you want to have different settings in subdirectories, you must place
them in a web.config in the directories the different settings apply to.

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/
=============== =============== =====
"Ben" <be*****@newsgr oups.nospamwrot e in message news:26******** *************** ****@FUSE.NET.. .
Steven,

Thanks for your reply. I haven't had any luck with this. The only way the settings (connection
strings) are inherited is if they are in the root of the site.

inetpub\wwwroot \web.config - main
inetpub\wwwroot \group1\web.con fig - shared
inetpub\wwwroot \group1\site1
inetpub\wwwroot \group1\site2
inetpub\wwwroot \group1\site3

With the file structure above, if I put a connection string in the main config file, site1, site2
and site3 see the connection string. If I remove the connection string from the main config and
place it in the shared config, none of the sites see the setting.

Is what I'm doing something that should be working? I thought so, but it isn't.

Thanks,
Ben

"Steven Cheng[MSFT]" <st*****@online .microsoft.comw rote in message
news:qu******** ******@TK2MSFTN GXA01.phx.gbl.. .
>Hello Ben,

How are you doing on this issue? Have you got any progress or still meet
any difficulties on this issue? If there is anything else we can help,
please feel free to let me know.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.


Aug 9 '06 #5
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\wwwroo t\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.con fig,
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.con fig,
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]" <st*****@online .microsoft.comw rote in message
news:c3******** ******@TK2MSFTN GXA01.phx.gbl.. .
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 <appSettingkeys ) 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(objec t sender, EventArgs e)
{
foreach (string key in WebConfiguratio nManager.AppSet tings.Keys)
{
Response.Write( "<br/>"+ key + ": " +
WebConfiguratio nManager.AppSet tings[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\xxx web 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.

Aug 10 '06 #6
re:
Do you mean if the sub directories are configured as "applicatio n", they
won't inherit the web.config setting from their parent (no matter they're
physical sub dir or the parent virtual dir or not)?
Steven,

are you telling me that in this physical/virtual directory structure :

c:\inetpub\wwwr oot -not an application
c:\inetpub\wwwr oot\group1 - not an application
c:\inetpub\wwwr oot\group1\site 1 - IIS Application
c:\inetpub\wwwr oot\group1\site 2 - IIS Application
c:\inetpub\wwwr oot\group1\site 3 - IIS Application

....that site1, site2 and site3 will inherit from c:\inetpub\wwwr oot 's
or c:\inetpub\wwwr oot\group1 's web.config ?

*That* is the structure I was commenting on.

I *never* configure wwwroot as an application,
precisely because I don't want to run the risk of inheritance ambiguities.

I have always thought that Application roots are the topmost level
for web.config inheritance boundaries, unless the IIS Application is nested,
in which case, yes, the Application will inherit from its parent Application. .

Maybe I'm not understanding something about the scenario ?


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]" <st*****@online .microsoft.comw rote in message
news:7N******** ******@TK2MSFTN GXA01.phx.gbl.. .
Hi Juan,

Thanks for your effort.

As for your following comments:

=============== ======
"If you place a setting in inetpub\wwwroot \group1\web.con fig,
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)
=============== =======

Do you mean if the sub directories are configured as "applicatio n", they
won't inherit the web.config setting from their parent (no matter they're
physical sub dir or the parent virtual dir or not)?

Actually, you can see(in the screenshot I attached) that those leaf
applications directories( "DemoWebsit e", "IISTestSit e", "NewTestSite".. ..)
are all configured as single application themselves. However, they can
still get the settings from the web.config files in the super path(in V2,
in ASPNET in Websites super parent dirs). The page in those applications
are accesed through the following style url.

http://localhost/ASPNET/V2/WebSites/...e/Default.aspx

In addition, I've also tested through a linked sub application (its
physical directory is outside the parent application/virtual dir 's
physical path, see the "linkedsubw eb" in my new attached screenshot), it
can also get the inherited values from parent web.configs.

Therefore, I still think web.config's inheritance in a IIS virtual
directory tree is certainly supported.

So far I'm still wondering what's the exact directory structure in IIS and
physical disk in Ben's test environment.

Sincerely,

Steven Cheng

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

Aug 10 '06 #7
Thanks for your quick reply Juan,

Yes, on my test server, the wwwroot is configured as "applicatio n" , and
this is the default setting after it is installed. Also, I've tested
removing the application(let it be a normal root virtual folder), and the
same result, sub web applications can still inhertis settings from all the
web.config files in the up level directorys(foll ow the virtual directory
tree).

As for the following statement;
=============== ============
I have always thought that Application roots are the topmost level
for web.config inheritance boundaries, unless the IIS Application is nested,
in which case, yes, the Application will inherit from its parent
Application. .
=============== ===========

I think for those application specific states such as SessionState,
Appilcation State, this the case, however, web.config setting will inherit
up level web.configs in super directories(no matter application or not)
based on my understanding and testing.
Sincerely,

Steven Cheng

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

Aug 10 '06 #8
Thanks for that heads-up, Steven.

I had been laboring under a mistaken assumption.

I just tested, changing the culture and uiCulture in the wwwroot and,
in spite of a test directory being configured as an application,
the culture setting *was* inherited from the root.

Thanks again.

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]" <st*****@online .microsoft.comw rote in message
news:n4******** ******@TK2MSFTN GXA01.phx.gbl.. .
Thanks for your quick reply Juan,

Yes, on my test server, the wwwroot is configured as "applicatio n" , and
this is the default setting after it is installed. Also, I've tested
removing the application(let it be a normal root virtual folder), and the
same result, sub web applications can still inhertis settings from all the
web.config files in the up level directorys(foll ow the virtual directory
tree).

As for the following statement;
=============== ============
I have always thought that Application roots are the topmost level
for web.config inheritance boundaries, unless the IIS Application is nested,
in which case, yes, the Application will inherit from its parent
Application. .
=============== ===========

I think for those application specific states such as SessionState,
Appilcation State, this the case, however, web.config setting will inherit
up level web.configs in super directories(no matter application or not)
based on my understanding and testing.
Sincerely,

Steven Cheng

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

Aug 10 '06 #9
Thanks Juan for your time,

So curerntly I'm still wondering the actual scenario of Ben's deployment
site and will wait for any further feedback. I think it important to make
this issue clear so that other guys won't suffer the problem any more.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 11 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
1638
by: Codex Twin | last post by:
Hi I have a common model for a Data Access Layer scenario. I have an abstract base class, called DalBase which contains a list of abstract methods. Lets call them: public abstract void Shine(); public abstract void Flow(); public abstract void Float(); I then have an inherited class, called DalMain which contains the concrete
1
1274
by: plaztik via DotNetMonster.com | last post by:
Hello, My company creates many similar web applications for clients. I was assigned the task of creating a versionable engine for producing these web applications easily and protecting our code. I am creating an assembly that functions as the guts of the web applications we are producing. This way, all our code is contained within a...
9
6363
by: Benny Ng | last post by:
Hi,all, How to let the sub-directory to avoid the authentication control from Root's webconfig? I heard that we can add a new web.config to the sub-directory. And then we can slove the problem. Virtual directory is £ºhttp://localhost/main Sub-directory is : http://localhost/main/reminder
8
6679
by: Spam Trap | last post by:
I am getting strange resizing problems when using an inherited form. Controls are moving themselves seemingly randomly, but reproducibly. "frmBase" is my base class (a windows form), and contains a few controls anchored to the sides of the form. "frmChild" inherits from "frmBase"... and the controls appear on the inherited form as...
0
1443
by: tomislav.bartolin | last post by:
Hi, I have inherited TaskSettings class from the ApplicationSettingsBase class and are able to get the configuration settings for this class quite nicely in my windows app. Now, if I inherit further from the TaskSettings class and create a ServerTaskSettings inherited class, the settings for the properties defined in the TaskSettings class...
4
1939
by: asad.naeem | last post by:
hi to all this is the problem about inheritence. I have designed a form with some essential controls which are required for every form which will inherited from it. for example i have Button1 on parent form and this button is visible to me on inherited form. The problem is: I have written a click event of the button1 on both of the forms....
0
1463
by: Jay Pondy | last post by:
I added a Company field to the aspNet_Users table and then followed along with the MSDN docs on How to Implement a Custom Membership User by creating my inherited class from the SqlMembershipProvider and another inherited from MembershipUser to contain the new Company field. In my new Provider class I have overridden the GetUser and...
3
1268
by: Brad | last post by:
Probably a very basic questions here: When using code to look at a web.config item, how can I tell if the value is/is not inherited? I have some common code that needs to iterate through settings like appsettings and connectionstrings but I only want to look at settings for the current web app: I would like to ignore a value if it comes...
1
1520
by: Zark3 | last post by:
Hello all, I've been given the task of rewriting part of a 1.1 app as a new 2.0 app. I'll have to keep the old directory name so references from the old app will sneakly direct the user straight into the new app. Now, the old app used forms authentication, so my question is can i re- use that authentication ticket so as not to have to worry...
0
7841
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7758
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7856
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8137
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5335
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3773
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1369
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1099
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.