The ask
The organization ran a large estate of internal web applications. Dozens of them, built across more than a decade and across nearly every web stack you can name: ASP.NET Web Forms, ColdFusion, more modern ASP.NET MVC, React, Angular, Blazor, and even SharePoint. Most were used across the organization. A few were used globally, by partner organizations in other countries.
The request sounded simple. When there is planned maintenance, an upcoming change, or any other announcement, we need to notify the users of these applications. Not by email, because email was already drowning and was not a reliable channel for this. The message had to reach people inside the applications they actually use, and it had to work globally.
So the real ask was this: reach every user of every app, inside the app, without email, and without the luxury of a shared codebase.
The real shape of the problem
The trap here is to treat this as a feature you add to applications. Go that way and the work explodes. Dozens of apps, seven or eight different front-end stacks, and a different team and release process behind many of them. Adding a notification banner "to each app" would mean building it one way for Web Forms, another for ColdFusion, another for React, another for SharePoint, and so on, then getting every one of those teams to accept, build, and deploy it. That project never finishes.
So I went looking for what all of these applications actually had in common. It was not a language. It was not a framework. It was not a team. The one thing every single one of them shared was this: they were web applications, served over HTTP, through a web server. That was the whole overlap. It turned out to be enough.
The reframe
A notification banner is not really an application feature. It is a few lines of HTML, a little CSS, and a little JavaScript, and those few lines do not care what rendered the rest of the page. A banner laid on top of the page sits there the same way whether the page came from Blazor or from ColdFusion.
So the move was to stop thinking about the applications at all and inject the banner one layer below them, at the web server, into the HTTP response itself. Do that, and the app's stack becomes irrelevant, because you are not touching the app. You are decorating its output on the way out the door.
The approach was passive by design, and that is the key to the whole thing. The applications never participate. They do not know the banner exists, and they are never asked to cooperate, change, or deploy anything. The notification reaches their users entirely from the outside, at the web server, without the application's involvement. That passivity is the point: it is exactly what lets one solution sit in front of dozens of apps that agree on nothing.

How it was built
The system had three parts.
An admin UI. A small application where a system administrator composes a notification, sets how long it runs, and chooses who sees it. A notification could be global, shown across the whole estate, or targeted at the users of one specific application. The admin also set the options on it, which I will come back to.
A store. The notifications, their targeting, and their options lived in one place that the injectors could read.
The injectors, one per web server type. This is where the banner actually gets into the page, and it was the only part that had to be built twice, because the estate ran on two different web servers.
The IIS side: a response filter
On Windows and IIS, the injector ran as an IIS module. In ASP.NET, a module is a class that implements IHttpModule and can hook into the request lifecycle. The key move is that ASP.NET lets you wrap the outgoing response in a filter, which is just a Stream that every byte of the response passes through on its way to the browser. So the module waits until the response is being produced, then swaps in a filter of its own:
The code below is simplified for illustration. It shows the shape of the approach, not the production implementation, and leaves out error handling, buffering details, and configuration.
public class HtmlInjectModule : IHttpModule
{
public void Init(HttpApplication app)
{
// Once the response is being built, wrap it in our filter.
app.PostAcquireRequestState += (sender, e) =>
{
var ctx = ((HttpApplication)sender).Context;
// Only touch HTML. Never rewrite CSS, JS, images, fonts, or JSON.
if (!IsInjectableHtml(ctx))
return;
ctx.Response.Filter = new InjectFilterStream(
ctx.Response.Filter, // keep the existing filter chain
FilterHtml, // our replacement function
ctx.Response.ContentEncoding);
};
}
// Insert the banner right after the opening <body> tag.
private string FilterHtml(string html)
{
var body = Regex.Match(html, "<body.*?>", RegexOptions.IgnoreCase);
if (!body.Success)
return html; // no body, nothing to do
return html.Replace(body.Value, body.Value + BannerHtml());
}
public void Dispose() { }
}
The filter stream itself is where the bytes actually get rewritten. As ASP.NET writes the page out, the stream decodes each chunk to text, runs the replacement, and writes the modified HTML on to the real response stream:
public override void Write(byte[] buffer, int offset, int count)
{
// Decode this chunk of the response to text...
var chunk = _encoding.GetString(buffer, offset, count);
// ...run the banner injection...
var modified = _replace(chunk);
// ...and write the result on to the original stream.
var bytes = _encoding.GetBytes(modified);
_inner.Write(bytes, 0, bytes.Length);
}
That is the whole trick on the Windows side. The module never touches the application. It sits in the response pipeline, finds the <body> tag in the HTML flowing past, and drops the banner in behind it.
The Apache side: ext_filter and sed
On Apache there was no custom module to write. Apache can already pipe a response through an external command as it goes out, using mod_ext_filter, so I let plain sed do the same substitution the C# filter did: find the opening <body> tag and insert the banner after it.
# Enable the module once: a2enmod ext_filter
# Define an output filter that pipes every HTML response through sed,
# inserting the banner right after the <body> tag.
ExtFilterDefine BannerInject mode=output intype=text/html cmd="/bin/sed -r 's~<body[^>]*>~&<div id=notice-banner>...</div>~'"
SetOutputFilter BannerInject
Same idea as the IIS module, a fraction of the code, because the platform already shipped a tool that rewrites a response stream. Two very different servers, one identical outcome: the banner is in the HTML before it reaches the browser, and no application was touched to put it there.
That injected banner carried a small script, and that script was the brain of the banner on the page. It pulled the active notification for the current application and user, rendered the banner, and handled everything the user did with it.
The gotchas
This is the part that separates "it worked in a demo" from "it ran across dozens of production apps."
Only touch HTML. The injector runs on every request, and most requests are not pages. They are stylesheets, scripts, images, fonts, and JSON API calls. Rewrite one of those and you corrupt it. So the very first thing the injector does is bail out on anything that is not an HTML response: it skips a list of static extensions (.css, .js, .png, .woff, .json, and so on) and only ever works on text/html. The Apache side gets this for free with intype=text/html.
Not breaking the host page. Even on a real HTML page, the injection has to be surgical. Pick a stable, universal insertion point, the opening <body> tag, and add your own element right after it rather than altering anything already there.
Handling a response that arrives in pieces. The response does not always come through the filter in one clean chunk, so an injector that scans each piece in isolation can miss a <body> tag that straddles a boundary. The filter has to account for the stream arriving in parts rather than assuming the whole document is in hand at once.
Not colliding with the app's own styles and scripts. This is the same lesson as fighting generated IDs in a legacy app, seen from the other side. Dozens of apps meant dozens of different CSS and JS environments, any of which could clash with the banner. So everything injected was namespaced hard: a unique container ID, every style scoped under it, and the script kept to its own scope so it could not step on whatever the host app was already running. The banner had to look and behave the same on an app with heavy global CSS and on a bare one.
Surviving single-page apps. React, Angular, and Blazor rewrite the page content on the client as the user navigates. The banner was injected into the initial HTML outside the app's mount point, so client-side navigation inside the app did not wipe it out. It sat above the application, not inside it.
An escape hatch. Occasionally a page genuinely should not be decorated. A request carrying a special header told the injector to leave that response untouched, which gave a clean way to exempt specific endpoints without special-casing them in code.
Keeping the per-request cost near zero. The injector runs on every request to every app, so it cannot hit the store each time. The active notifications were cached in memory and refreshed on an interval, so the common case, which is "there is nothing to show," cost almost nothing.
Handling dismissal safely. When a notification was dismissible, the script called back an endpoint to record it. That callback was same-origin and authenticated, so a dismissal was tied to a real user and could not be forged.
What the admin could control
The options on a notification are where this went from "a banner" to something genuinely useful for running an estate of applications:
- Dismissible or not. A routine notice could be dismissed. A mandatory one, such as a hard maintenance window, could be made non-dismissible so it stayed on screen.
- Dismissal tracking. For important notices, the system recorded who dismissed it and when, so there was a record of who had actually seen a given announcement.
- Show once. After a user dismissed a notification, it did not come back for them, instead of nagging on every page load.
Why this beat the alternatives
Email was off the table, and would have been ignored anyway. Building the banner into every application was impossible at that scale and would have required every team to cooperate and ship. Even a shared front-end snippet would have needed every app to adopt it and redeploy, which across that many stacks and teams is its own multi-year project.
The injector at the web server needed none of that. Zero changes to any application. Zero cooperation from any app team. One place to author a message, and it appeared, consistently, on top of every application in the estate, including the ones used on the other side of the world.
The pattern, at its most extreme
If you have read my other posts, you have seen this instinct before. Solve a cross-cutting concern once, at the boundary, rather than inside the applications. Inject what you need into the response rather than editing the source.
Passive injection is both of those ideas at once, pushed as far as they go. The most mismatched estate imaginable, every framework, many teams, some of it running globally, and still one thin layer where all of it overlapped. Find that layer, and a problem that looked like "change dozens of applications" becomes "add one thing none of them have to know about."
That is almost always where the leverage is. Not in touching everything, but in finding the one place that already touches everything for you.