我如何可以通过编程修改aspx文件内容之前处理程序处理呢? [英] How can I programmatically modify an aspx file content before the handler handle it?

查看:188
本文介绍了我如何可以通过编程修改aspx文件内容之前处理程序处理呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我之所以需要修改一个aspx的内容(而不是身体,而是改在内存中的内容),因为有我做之前,整个ASPX被处理需要被解析到正确的数据一定的自定义标签在HttpHandler的。

The reason I need to modify the content of an aspx (not physically, but change the content in the memory) is because there are certain custom tags I made needs to be parsed to the correct data before the entire aspx is handled by the HttpHandler.

有没有一个办法?

推荐答案

您可以使用响应滤波器(HttpFilter)和修改内容的动态,响应基本形成后,过滤器被称为EndRequest之前(这是一个流后裔)并且你愿意,你可以修改它。在HTTP模块,你有init方法来安装HttpFilter(Response.Filter),它会调用该请求。

You can use Response Filters (HttpFilter) and modify content on the fly, basically after response is formed, before EndRequest your filter is called (it's a stream descendant) and you can modify it as you wish. In the HttpModule, Init method you got to install HttpFilter (Response.Filter) and it will be called for that request.

下面是一个很好的文章:

Here is a good article :

http://aspnetresources.com/articles/HttpFilters

更新:
也许这就是 XY问题的情况下,你可以解决你的问题简单的服务器控件,这将正确显示这些自定义的标签。

UPDATE: Maybe this is a case of XY Problem, and you can solve your problem with simple server control that will render these custom tags properly.

这篇关于我如何可以通过编程修改aspx文件内容之前处理程序处理呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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