是否有某种方式来拦截和修改asp.net HTML输出流,给JavaScript结合? [英] Is there some way to intercept and modify the html output stream in asp.net, to combine the javascript?

查看:148
本文介绍了是否有某种方式来拦截和修改asp.net HTML输出流,给JavaScript结合?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有某种方式来拦截在asp.net的HTML输出流,并进行修改?例如,使用的HttpModules还是什么?我知道这是可能使用Java servlet和承担必须有一个优雅的方式与asp.net做到这一点。

Is there some way to intercept the HTML output stream in asp.net and make modifications? Eg using httpmodules or something? I know this is possible using java servlets and assume there must be an elegant way to do this with asp.net.

我的目的是将众多的JavaScript文件合并到已缩小的/包装的一个组合的脚本,使页面加载速度更快。

My purpose is to combine the many javascript files into one composite script which has been minified/packed, to make the page load faster.

例如,如果我的页面正常输出以下页面头:

Eg, if my page normally outputs the following in the page head:

<script type="text/javascript" src="/scripts/blah.js"></script> 
<script type="text/javascript" src="/scripts/yada.js"></script> 

我要替换与以下内容:

I want to replace that with the following:

<script type="text/javascript" src="/scripts/all.js"></script> 

(也是我认识到我必须以某种方式创建all.js的)。
谢谢!

(also i realise i'll have to create all.js somehow). Thanks!

推荐答案

您可以设置的 Response.Filter

You can set Response.Filter.

这篇关于是否有某种方式来拦截和修改asp.net HTML输出流,给JavaScript结合?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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