p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

Free Code from Wrox
Go Back   p2p.wrox.com Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
I forgot my password
Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other programmers’ questions, win occasional prizes given to our best members, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 14th, 2004, 03:46 AM
Authorized User
Points: 96, Level: 1
Points: 96, Level: 1 Points: 96, Level: 1 Points: 96, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Rottum, , Netherlands.
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
  #2 (permalink)  
Old June 14th, 2004, 04:32 AM
Imar's Avatar
Wrox Author
Points: 35,654, Level: 82
Points: 35,654, Level: 82 Points: 35,654, Level: 82 Points: 35,654, Level: 82
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 10,575
Thanks: 12
Thanked 284 Times in 280 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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
  #3 (permalink)  
Old June 14th, 2004, 05:50 AM
Authorized User
Points: 96, Level: 1
Points: 96, Level: 1 Points: 96, Level: 1 Points: 96, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Rottum, , Netherlands.
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
  #4 (permalink)  
Old June 14th, 2004, 06:27 AM
Imar's Avatar
Wrox Author
Points: 35,654, Level: 82
Points: 35,654, Level: 82 Points: 35,654, Level: 82 Points: 35,654, Level: 82
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 10,575
Thanks: 12
Thanked 284 Times in 280 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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
  #5 (permalink)  
Old June 14th, 2004, 06:56 AM
Authorized User
Points: 96, Level: 1
Points: 96, Level: 1 Points: 96, Level: 1 Points: 96, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Rottum, , Netherlands.
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
  #6 (permalink)  
Old June 14th, 2004, 07:02 AM
Imar's Avatar
Wrox Author
Points: 35,654, Level: 82
Points: 35,654, Level: 82 Points: 35,654, Level: 82 Points: 35,654, Level: 82
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 10,575
Thanks: 12
Thanked 284 Times in 280 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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
  #7 (permalink)  
Old June 14th, 2004, 07:21 AM
Authorized User
Points: 96, Level: 1
Points: 96, Level: 1 Points: 96, Level: 1 Points: 96, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Rottum, , Netherlands.
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
  #8 (permalink)  
Old June 14th, 2004, 08:42 AM
planoie's Avatar
Friend of Wrox
Points: 16,368, Level: 55
Points: 16,368, Level: 55 Points: 16,368, Level: 55 Points: 16,368, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,394
Thanks: 0
Thanked 2 Times in 2 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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
  #9 (permalink)  
Old June 14th, 2004, 11:51 AM
Authorized User
Points: 96, Level: 1
Points: 96, Level: 1 Points: 96, Level: 1 Points: 96, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Rottum, , Netherlands.
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'll have to live with it.
Thanks,

Gerhard Wentink
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

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 04:01 AM
Remove UserForm lostthought VB How-To 0 July 29th, 2004 01:46 PM
How to remove ? abdusalam Javascript How-To 1 July 27th, 2004 02:24 AM
How to remove the toolbar? larry HTML Code Clinic 1 April 30th, 2004 07:33 PM



All times are GMT -4. The time now is 08:13 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
© 2010 Wiley Publishing, Inc