我可以向多个.net应用程序添加页脚吗?

编程入门 行业动态 更新时间:2024-10-23 14:32:44
本文介绍了我可以向多个应用程序添加页脚吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想在一个由经典asp和各种应用程序混合而成的网站上实现google analitycs.所有经典的ASP页都共享一个footer.inc文件,因此您可以毫不费力地进行操作.但是,页面不共享任何内容,有时甚至不使用母版页.有没有一种方法可以编译DLL,将其放入GAC并仅在web.config中引用它?

I would like to implement google analitycs on a website that's a mix of classic asp and various applications. All classic ASP pages share a footer.inc file, so that's a no brainer. However, the pages don't share anything, and sometimes don't even use master pages. Is there a way i could compile a DLL, drop it into the GAC and just reference it in web.config?

谢谢!

推荐答案

您可以创建 IHttpModule ,您可以在其中向响应流添加过滤器.

You can make an IHttpModule, in which you add a filter to the response stream.

在该过滤器中,您可以查找(例如)结束正文标记,然后在其中添加所需的任何标记.这是一篇详细介绍此方法的文章: HttpFilters .

In that filter, you can look for the closing body tag, (for instance), and add whatever markup you need, there. Here is an article with details on the approach: HttpFilters.

准备好模块后,可以将该模块放入GAC中,并在每个应用程序的web.config中对其进行引用.如果需要服务器上的每个.NET应用程序,也可以将其放在机器范围的web.config文件中(以免您编辑所有web.configs的麻烦).该文件位于 C:\ Windows \ System \ Microsoft.NET \ Framework \< version> \ CONFIG

When you have the module ready, you can put the module in GAC, and reference it in the web.config for each of your applications. If you need on every .NET application on the server, you could also put it in the machine-wide web.config file (to save you the trouble of editing all the web.configs). This file is found in C:\Windows\System\Microsoft.NET\Framework\<version>\CONFIG

更多推荐

我可以向多个.net应用程序添加页脚吗?

本文发布于:2023-11-15 16:39:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1596174.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多个   应用程序   net   页脚吗

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!