Wrox Programmer Forums
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 14th, 2004, 02:46 AM
Authorized User
 
Join Date: Jun 2003
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default remove httpModule

To use a httpModule I added the module to the web.config. Since I don't want files in a subdirectory to use this module I placed a web.config in this directory where the module is removed.
This approach did not work (that is: the httpModule was still called by the files in the subdirectory), until I made an application of the subdirectory in IIS and copied all the dll's from the /bin in the root of the application to the /bin of the subdirectory.

Is this normal behaviour? From all the documentation on this subject I learned that a web.config in a subdirectory overrules the one in the root without any other modifications.
Can anyone shed light upon this?

Regards,

Gerhard Wentink
__________________
Gerhard Wentink
 
Old June 14th, 2004, 03:32 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Yes, this is normal behavior. AFAIK, a Web.Config will override behavior defined in the root for applications only; not for individual sub folders.

That's why you often see the error "It is an error to use a section registered as allowDefinition bla bla bla"; this usually means that someone is using a Web.Config file, without changing the specified folder to an application.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old June 14th, 2004, 04:50 AM
Authorized User
 
Join Date: Jun 2003
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Imar,

Apparently it is as you said, but see this excerpt from the MSDN library:

<quote>
ASP.NET configuration files are called Web.config. Configuration files in ASP.NET applications inherit the settings of configuration files in the URL path. For example, given the URL www.microsoft.com/aaa/bbb, where www.microsoft.com/aaa is the Web application, the configuration file associated with the application is located at www.microsoft.com/aaa. ASP.NET pages that are in the subdirectory /bbb use both the settings that are in the configuration file at the application level and the settings in the configuration file that is in /bbb.
</quote>

Here it seems if placing a web.config in a directory is enough. At least it is not very clear. Do you know resources, besides MSDN, that can educate me on this topic?

Regards,

Gerhard Wentink
 
Old June 14th, 2004, 05:27 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Well, it depends on the type of information you store in the Web.config file.

Some settings (and I believe httpModules are part of that) apply to an application, and therefore need to reside in an application folder.
Other settings (Keys of node type Add under <appSettings> for example) can be overridden in a Web.Config folder below the application root and without marking the folder as a separate application. If you add the following code to a Web.Config file in a folder that is not marked as a VD, you can still retrieve the info on that folder's level:
Code:
<configuration>
  <appSettings>
    <add key="MyKey" value="Bla Bla Bla" />
  </appSettings>
</configuration>
Even if MyKey has been defined at a higher level, this code:

System.Configuration.ConfigurationSettings.AppSett ings.Get("MyKey");

will give you Bla Bla Bla from the sub folder.

I always thought that only elements defined as MachineToApplication and MachineOnly (defined in your Machine.config file) could not be overridden in config files located deeper in the hierarchy. However, the httpModules does not have these attributes defined, so right now I am a bit stumped as to what you can and what you cannot override in Web.Config files.....

So, unfortunately, I do not know the exact answer; some settings work; others don't. I browsed some of my bookmarks for articles about this, but haven't found anything useful yet.....

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old June 14th, 2004, 05:56 AM
Authorized User
 
Join Date: Jun 2003
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I "consulted" Google a few times on this subject and I found an article on 15 Seconds about HttpHandlers and HttpModules: http://www.15seconds.com/issue/020417.htm . This guy is also not very clear about this.
I'll keep searching. Thanks for your time.

Best regards,

Gerhard Wentink
 
Old June 14th, 2004, 06:02 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Can you get it to work if you use <location> elements in your root Web.Config to control various sub folders?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old June 14th, 2004, 06:21 AM
Authorized User
 
Join Date: Jun 2003
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, I tried that. And then I also have to make an application of the subdirectory and copy the dll's.

Regards,

Gerhard Wentink
 
Old June 14th, 2004, 07:42 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

I'm in the same boat on this one. It's one of those "works with this but not that" things. As Imar has mentioned, it works with <add ...> nodes and it works for some aspects of security such as changing who can access the application pages within the directory that contains the web.config. I haven't played around much with anything beyond that within application sub directories.
 
Old June 14th, 2004, 10:51 AM
Authorized User
 
Join Date: Jun 2003
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'll have to live with it.
Thanks,

Gerhard Wentink





Similar Threads
Thread Thread Starter Forum Replies Last Post
httpmodule to count number of clicks a specific li Sheraz Khan ASP.NET 2.0 Professional 0 November 15th, 2008 02:35 PM
remove node asap XSLT 1 July 30th, 2006 03:01 AM
Remove UserForm lostthought VB How-To 0 July 29th, 2004 12:46 PM
How to remove ? abdusalam Javascript How-To 1 July 27th, 2004 01:24 AM
How to remove the toolbar? larry HTML Code Clinic 1 April 30th, 2004 06:33 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.