系统未定义 [英] Sys is undefined

查看:37
本文介绍了系统未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个正在处理的 ASP.Net/AJAX 控制工具包项目.80%的时间没有问题.页面正常运行.如果您刷新页面,它有时会显示一个 javascript 错误系统未定义".

I have an ASP.Net/AJAX control kit project that i am working on. 80% of the time there is no problem. The page runs as it should. If you refresh the page it will sometimes show a javascript error "Sys is undefined".

它不会一直发生,但它是可重现的.发生这种情况时,用户必须关闭浏览器并重新打开页面.

It doesn't happen all the time, but it is reproducible. When it happens, the user has to shut down their browser and reopen the page.

这让我相信它可能是一个 IIS 设置.

This leads me to believe that it could be an IIS setting.

另一个注意事项.我在收到错误时和没有时都查看了页面源代码.当页面抛出错误时,缺少以下代码:

Another note. I looked at the page source both when I get the error, and when not. When the page throws errors the following code is missing:

<代码>< SCRIPT SRC = /的ScriptResource.axd d = EAvfjPfYejDh0Z2Zq5zTR_TXqL0DgVcj_h1wz8cst6uXazNiprV1LnAGq3uL8N2vRbpXu46VsAMFGSgpfovx9_cO8tpy2so6Qm_0HXVGg_Y1&安培; amp; T公司= baeb8cc" 类型= 文本/JavaScript的" ></脚本><script type="text/javascript">//<![CDATA[if (typeof(Sys) === 'undefined') throw new Error('ASP.NET Ajax 客户端框架加载失败.');//]]>

推荐答案

我通过移动 <script type="text/javascript"></script> 块解决了我的问题Sys.* 在页面上的 HTML 中向下调用(到正文的 <asp:Content/> 部分结束之前的最后一项).我最初在页面的 HEAD <asp:Content/> 部分中有我的脚本块.我在一个有 MasterPageFile 的页面中工作.希望这对某人有所帮助.

I fixed my problem by moving the <script type="text/javascript"></script> block containing the Sys.* calls lower down (to the last item before the close of the body's <asp:Content/> section) in the HTML on the page. I originally had my the script block in the HEAD <asp:Content/> section of my page. I was working inside a page that had a MasterPageFile. Hope this helps someone out.

这篇关于系统未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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