How to inject HTML before closing html tag in a HTTPModule

 ̄綄美尐妖づ 提交于 2019-12-04 20:33:46

You should use an HttpContext.Response.Filter.

Check this MSDN documentation page:

This very old article should clarify this too:

Summarizing, you need to create a Stream implementation wrapping the original one coming in HttpContext.Current.Response.Filter.

In order to inject HTML in some part of the document, you simply need to convert bytes into a string and using a String.IndexOf or a regular expression you're going to deremine if you're in the whole code line.

After that, just concatenate, modify or replace obtained string and put it in the wrapped Stream coming in the original, default response filter.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!