473,785 Members | 2,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3212
Hi Sam,

I've dealt with this sort of thing a few times as well. To be honest the
<removemodule s 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.Http Application
{
public static xrnsToashxMappi ngModule Module = new
xrnsToashxMappi ngModule();
public override void Init()
{
base.Init();

Module.Init(thi s);
}

}
Hope this helps,

+++ Rick ---

--

Rick Strahl
West Wind Technologies
www.west-wind.com/weblog
"Samuel R. Neff" <sa********@nom ail.comwrote in message
news:8u******** *************** *********@4ax.c om...
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
1852
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) http://localhost/myapp/newFolder (web folder in the above virtual dir maps to C:\MyApp\NewFolder) Can I have one web.config file at C:\MyApp and another at C:\MyApp\NewFolder? When I tried to do this, VS.NET web project (during debugging) throws an errors...
2
2144
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) Implements IHttpModule.Init httpApp = context
4
1644
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
1927
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 http module was included in the root site which is GRSCS and the webservice has not functioned ever since. the service starts working when u comment the httpmodule section in the web.config file of the main (root application) which is GRSCS. Is...
3
2185
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 declared of course into the Webconfig. This application runs perfect. So, i created another application (Accreditation), that runs perfect too inside of it as a virtual directory that does not use HttpModule. Now i am getting this error....
2
2405
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 work, maybe I will make a new one later, or use the build -in ) But to my problem ... I have a Admin area, but that users dont have
0
4669
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 http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx. In Vista when I press F5 or Control F5 I get an error message saying HTTP Error 500.19 - Internal Server Error Description: The requested page cannot be accessed because the related...
5
2445
by: =?Utf-8?B?TUNN?= | last post by:
What do the following httpModules do? UrlAuthorization FileAuthorization ServiceModel ErrorHandlerModule ScriptModule
2
7397
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 system cannot fond the file specified error. When I comment out the line in the web config file, I get the error on the line following that. I have all the dll files in the bin folder.
0
9481
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10341
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10155
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10095
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9954
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6741
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5513
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4054
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.