使用 ScriptManager 而不需要额外的 JS 文件?
当我在 VS2010 中创建一个新的 ASP 4.0 网站并通过 IE9 开发人员工具检查它时,我只看到一个隐藏在 WebResource.axd 后面的 JavaScript 文件。这是预期的,但是一旦我添加 ScriptManger 进入我的网站,我意外地获得了另外三个 JavaScript 文件,所有这些文件都隐藏在 ScriptResource.axd 后面。我认为其中两个额外的 JavaScript 文件似乎与 Microsoft 的 ASP.NET AJAX 实现有关,但我不知道第三个额外的 JS 文件是做什么的。
有什么方法可以使用 ASP 4.0 ScriptManager,而无需将三个额外的 JavaScript 文件提供给客户端?
我添加到页面的脚本管理器标签如下:
<asp:ScriptManager ID="myScriptManager" runat="server" />
谢谢,
Shawn
注意:即使 SO Scriptmanager 删除 javascript 线程有类似的标题,我认为它与我的问题无关,因为我认为提到的线程正在询问主网络表单中的 内联 JavaScript,而我正在询问大量隐藏在 HttpHandler 后面的外部 JavaScript 文件。
When I create a new ASP 4.0 WebSite in VS2010 and examine it via the IE9 Developer Tools, I only see a single JavaScript file hiding behind WebResource.axd. This is expected, but as soon as I add a ScriptManger into my WebSite, I unexpectedly get three more JavaScript files all of which are hiding behind ScriptResource.axd. I think that two of these extra JavaScript files appear to be related to Microsoft’s implementation of ASP.NET AJAX, but I have no idea what the third extra JS file is for.
Is there any way I can use the ASP 4.0 ScriptManager without feeding the three extra JavaScript files down to the client?
The script manager tag I am adding to my page is as follows:
<asp:ScriptManager ID="myScriptManager" runat="server" />
Thanks,
Shawn
Note: Even though the SO Scriptmanager remove javascript thread has a similar title, I don't think it is related to my question since I think the mentioned thread is asking about inline JavaScript in the primary webform while I am asking about numerous external JavaScript files that hide behind an HttpHandler.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
似乎可以通过属性
AjaxFrameworkMode
来控制 ScriptManager 将哪些 javascript 文件添加到页面(doc)。然而,根据您打算利用它的用途,可以避免在您的页面中包含它。
例如,要使用 PageMethods,您可以直接向该方法发出 ajax 请求。关于 Encosia 的一篇很好的 文章 讨论了这一点。
It seems possible to control what javascript files are added to the page by the ScriptManager via the property
AjaxFrameworkMode
(doc).Nevertheless, depending on the use you intend to make out of it, it is possible to avoid including one in your pages.
For instance, to use PageMethods, you can make ajax requests directly to the method. A good article on Encosia deals with that.