Wednesday, March 28, 2012

web.config inheritance

I have the following setup --

wwwroot\web.config

wwwroot\application1\web.config

I have application1 flagged as it's own application within IIS. The
behavior I'm seeing is that application1 still inherits from the wwwroot's
web.config. I thought that if application1 was set as it's own application
within IIS, it would override that inheritance. Seems from postings in
various newsgroups that this is wrong. Is this right?

Is there anyway to have application1's web.config not inherit from its
parent directory's web.config?

Thanks, GalenHi Galen,

You may refer to following article to see if the last section address the
problem:

Configuration Inheritance
http://msdn.microsoft.com/library/d...-us/cpguide/htm
l/cpconconfigurationinheritance.asp

You may create a new virtual folder to the phiscal folder and test again.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Hello,

If my suggestion is not clear or you didn't think it can resolve the
problem, please post your comments here. I will continue to follow up on
this issue.

Thanks,

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Hello,

If my suggestion is not clear or you didn't think it can resolve the
problem, please post your comments here. I will continue to follow up on
this issue.

Thanks,

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
It seems from your postings that the web.config will inherit from its
parent's directory, based on the URL request path, no matter if it is
configured as its own application within IIS or not.

From what I gather, the only thing configuring a virtual directory or a
directory as its own application does, is give it its own bin directory
where the framework will load assemblies from.

Are both these correct?
Hi Galen,

In ASP.NET, the last configuration setting overwrites settings for the same
section provided in parent directories, for example, when we
access:

Http://localhost/webapp1/sfolder1/webform1.aspx

It will use web.config in sfolder1overwrite web.config in webapp1.

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Hi Galen,

Yes, web.config files always inherit/override. However, it is also realted
to if it is configured as its own application within IIS or not. For
example, we have a web application "webapplication1" and set it to form
authentication in Web.config. If we open:

Http://localhost/webapplication1/somewebform.aspx

it will first redirect to login form

And we add a sub folder under \inetpub\wwwroot\webpllication1\" named
"sub1", and open:

Http://localhost/webapplication1/sub1/somewebform.aspx

It will also redirect to login form since its web.config is inherit.

However, if we create a virtual directory in IIS for sub1 and open

Http://localhost/sub1/somewebform.aspx

It wouldn't redirect to login form.

If we open :

Http://localhost/webapplication1/sub1/somewebform.aspx

It still redirect to login form.

Did I make question clear?

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

0 comments:

Post a Comment