Injecting a piece of html in all applications in IIS

R

rh.krish

Hi,
I have a unique situation. We have many applications (approx - 20)
built on .NET framework 1.1 & 2.0 and hosted in one single IIS website
in PROD. We have similar setup in TEST. Now we want to have a banner
indicating that the website being accessed by the user is TEST. This
is because, there are some users who have access to both and sometimes
they do stuffs in PROD which are meant to be done only in TEST. By
displaying somekind of floating banner or injecting a small piece of
html in the header indicating that it is a TEST server, we can solve
this issue. Though none of those applications use Master pages, they
do have a header section in all their pages where I have some space to
inject this text. Now the question is how do I do it without touching
all the applications? I'm looking for a solution where I write some
piece of code and deploy it in the server and make all applications
automatically pull this with least amount of changes to these
applications (only configurable changes). I believe http module can do
this. But again, the http module has to be registered in the
web.config file's of all the applications, I guess. Please let me know
if you have any idea on tackling this issue.

Thanks.
 
R

rh.krish

Nevermind. I found the solution. Here are the steps:

1. Create an HttpModule and have the code to inject a small piece of
html (thru Response.Write).
2. Sign the assembly
3. Install the assembly into GAC
4. Add the entry in machine.config (<add name="EnvWarningHandler"
type="EnvWarningHandler.EnvWarningHandler, EnvWarningHandler,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=f9493d8c172e582f"/>)


That's it. Try accessing any page from any application and it will
insert the html that you had in your http handler.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top