473,399 Members | 4,177 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Web.config httpModules remove if exists?

We have a problem with Web.config inheritance in two of our
applications. We have an old app which is poorly written and must be
in the root of the server. We have a newer app which runs from a
virtual directory. The apps are not related.

Old app web.config has:

<httpModules>
<add name="a" type="foo.a, foo" />
<add name="b" type="bar.b, bar" />
</httpModules>

So in the new app we get errors that it can't find assemblies "foo"
and "bar'. If we add this to the new app's web.config:

<httpModules>
<remove name="a" />
<remove name="b" />
</httpModules>

it works only on developer machines that have both apps--fails
otherwise (error removing module that doesn't exist).

The only solution we can think of is to create a fake app which has
empty modules with the same names as the old app's modules and install
that on the developer machines that only work on the new app. This
shoud work but is really ugly.

Are there any other options? (fixing the old app is not an option
right now due to resources and the time it would take to fix it and
it's only a problem in development, not testing or production).

Thanks,

Sam

Apr 5 '07 #1
1 3158
Hi Sam,

I've dealt with this sort of thing a few times as well. To be honest the
<removemodules should do the trick though unless you're not removing in
the right place - the problem may show up in any intermediary Virtuals as
well...

One thing that you can look at is loading the modules via code so they don't
show up in the root config file. It would require touching your 1.1 app, but
it's going to be very simple and can be done in global.asax if necessary...

It's easy to do - just manually attach the module in the Init() method of
your HttpApplication instance (ie. global.asax/cs):

public class Global : System.Web.HttpApplication
{
public static xrnsToashxMappingModule Module = new
xrnsToashxMappingModule();
public override void Init()
{
base.Init();

Module.Init(this);
}

}
Hope this helps,

+++ Rick ---

--

Rick Strahl
West Wind Technologies
www.west-wind.com/weblog
"Samuel R. Neff" <sa********@nomail.comwrote in message
news:8u********************************@4ax.com...
We have a problem with Web.config inheritance in two of our
applications. We have an old app which is poorly written and must be
in the root of the server. We have a newer app which runs from a
virtual directory. The apps are not related.

Old app web.config has:

<httpModules>
<add name="a" type="foo.a, foo" />
<add name="b" type="bar.b, bar" />
</httpModules>

So in the new app we get errors that it can't find assemblies "foo"
and "bar'. If we add this to the new app's web.config:

<httpModules>
<remove name="a" />
<remove name="b" />
</httpModules>

it works only on developer machines that have both apps--fails
otherwise (error removing module that doesn't exist).

The only solution we can think of is to create a fake app which has
empty modules with the same names as the old app's modules and install
that on the developer machines that only work on the new app. This
shoud work but is really ugly.

Are there any other options? (fixing the old app is not an option
right now due to resources and the time it would take to fix it and
it's only a problem in development, not testing or production).

Thanks,

Sam
Apr 6 '07 #2

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

Similar topics

6
by: Raghu | last post by:
Is it possible to have multiple web.config files in a given virtual directory in different directories? For example: http://localhost/myapp (Virtual directory maps to C:\MyApp)...
2
by: Simon-Pierre Jarry | last post by:
Hi, I created a custom HttpModule for managing the security of my application. in "Init" sub, I regsiter the events doing that : Public Sub Init(ByVal context As System.Web.HttpApplication)...
4
by: Bill Long | last post by:
Hi, I have a situation like this: wwwroot has a web.config file that adds a custom http module <httpModules> <add name="MyModue" type="MyType,MyAssembly" /> </httpModules>
1
by: Asela Gunawardena | last post by:
Hi all, we have a webservice as a seperate virtual directory placed under a Web Site named GRSCS in IIS. Both are .NET applications and uses MS application blocks as the data layer. Recently an...
3
by: Jose Fernandez | last post by:
HI first of all, excuse me for my english. And Thank in advance for even read my post. I have a problem that is driving me insane. I have an application (JUCAR) which use HttpModule and i have...
2
by: Mikael Syska | last post by:
Hi, Google gives alot of hits on httpmodules but I can't seem to find any useful on my problem ... I have a site where I'm using my own auth system ... ( guess it could be better but its...
0
by: mazdotnet | last post by:
Hi, I'm using UrlRewriter.NET in my project which is causing problems when in Vista (same code works fine on Windows XP). I'm going by the example in Scott's Blog...
5
by: =?Utf-8?B?TUNN?= | last post by:
What do the following httpModules do? UrlAuthorization FileAuthorization ServiceModel ErrorHandlerModule ScriptModule
2
by: =?Utf-8?B?YW5vbg==?= | last post by:
I am not sure if this is the right forum. Environment : Windows server 2008, IIS 7.0 I get the 'Could not load the file or assembly 'blowery.web.httpCompress' or one of its dependencies. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.