Can i add a footer to multiple .net applications?

点点圈 提交于 2019-12-24 19:23:14

问题


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?

Thanks!


回答1:


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

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.

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



来源:https://stackoverflow.com/questions/1868668/can-i-add-a-footer-to-multiple-net-applications

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