在 HttpModule 中向页面添加页脚

发布于 2024-10-09 09:45:40 字数 96 浏览 7 评论 0原文

我可以使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

幸福丶如此 2024-10-16 09:45:40

使用 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文