如何强制ASP.NET AJAX使用脚本从FS,而不是WebResource.axd的,或者减少其HTTP请求? [英] How do I force ASP.NET Ajax to use a script from the FS and not WebResource.axd, or to reduce its HTTP requests?

查看:177
本文介绍了如何强制ASP.NET AJAX使用脚本从FS,而不是WebResource.axd的,或者减少其HTTP请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我还没有找到一个答案的一个问题的嗡嗡声,薛定谔。

Here is a hum-dinger of a problem that I have not found an answer for.

我使用了几页,其本质要通过WebResource.axd的加载脚本资源ASP.NET AJAX控件工具包控制。这是一个好主意对于一些应用,但每次调用WebResource.axd的要求的HTTP请求。大多数页面将拉动从WebResource.axd的至少3或4个资源,所以这许多HTTP请求每一页发出。

I am using the ASP.NET ajax control toolkit controls on a few pages, which by nature want to load script resources via WebResource.axd. This is all well and good for some applications, but each call to WebResource.axd requires an HTTP request. Most pages will pull at least 3 or 4 resources from the WebResource.axd, so this many HTTP requests are issued for each page.

由于有太多的HTTP请求将产生负面影响性能性能和用户感知,我想修剪下来到1的HTTP请求,如果可能的话。

Since having too many HTTP requests will negatively impact performance and user perceptions of performance, I would like to trim that down to 1 HTTP request, if possible.

如果我能提取的AXD脚本或配置asp.net AJAX使用脚本,而不是WebResource,它真的是甜的。

If I could extract the script from the AXD or configure asp.net ajax to use a script instead of the WebResource, it would really be sweet.

有谁知道我可以去,而使用asp.net AJAX实现最终目标? (这时,另一个JS AJAX框架是不是一种选择。)

Does anyone know how I can go about accomplishing the end goal while using asp.net ajax? (At this moment another JS AJAX framework is not an option.)

编辑:找到解决方案。这家伙是永远狡猾,我将欠他很多餐/啤酒应我们曾经相遇。 HTTP://www.$c$cproject.com/KB/aspnet/fastload的.aspx

Found the solution. This guy is eternally crafty and I will owe him many meals/beer should we ever meet. http://www.codeproject.com/KB/aspnet/fastload.aspx

编辑:找到另一个解决方案 - 显然是MS允许你下载脚本的,而不包括资源DLL。所有你需要做的就是将它们包括在项目设置上的脚本经理依靠ScriptPath。

Found another solution -- apparently MS allows you to download the scripts without including the resource dll. All you need to do is include them in the project and set the ScriptPath on the Script Manager.

推荐答案

简单的路线:定义适当的HTTP缓存头。用户代理将多个请求梳理的基础上他们同样的资源,你不必围绕破解问题在服务器端。

The easy route: Define proper HTTP caching headers. The user agent will sort out multiple requests to the same resource based on them, and you don't have to hack around the problem on the server side.

这篇关于如何强制ASP.NET AJAX使用脚本从FS,而不是WebResource.axd的,或者减少其HTTP请求?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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