我可以向多个.net应用程序添加页脚吗? [英] Can i add a footer to multiple .net applications?

查看:79
本文介绍了我可以向多个.net应用程序添加页脚吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I would like to implement google analitycs on a website that's a mix of classic asp and various .net applications. All classic ASP pages share a footer.inc file, so that's a no brainer. However, the .net 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应用程序添加页脚吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆