在 HttpModule 中向页面添加页脚
我可以使用 EndRequest 等后期事件并将其放入 Response.Write 中,但这样我添加的任何内容都会出现在 /html 标记之后,并且 HTML 的格式不会很好。
I could use late events such as EndRequest and put inside Response.Write but this way whatever I'm adding would come after the /html tag and the HTML won't be well formed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 HttpModule 作为页脚是非常糟糕的做法。这可能会导致 UpdatePanel 出现错误,并且随机页面上的其他控件也可能出现错误 - 特别是当您尝试添加控件时。
此外,它可能会延迟所有页面的加载,并消耗大量内存来读取页面并在每个请求的末尾附加字符串。
使用母版页!。这是非常简单且正确的方法。
更多内容请阅读:使用母版页创建布局
Very bad practice to use the HttpModule for page footer. This can lead to possible errors with UpdatePanels, and possible with other controls on randomly pages - especial if you try to add controls.
Also its probably delay the load of all pages and eat a lot of memory reading the page and append at the end strings on every single request.
Use a master page !. Its very simple and the correct way.
More to read: Creating a Layout Using Master Pages