获取JavaScript运行时错误:irrationalPath,这是什么意思? [英] Getting JavaScript runtime error: irrationalPath, what does it mean?

查看:297
本文介绍了获取JavaScript运行时错误:irrationalPath,这是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的MasterPage中,我使用以下脚本

 < script type =text / javascriptsrc = http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.3\"></script> 

在我的应用程序中,我有这个平静的JavaScript代码

  document.getElementById(menu_number).src =<%= HttpContext.Current.Request.ApplicationPath%> / UI / Common / Images /向下箭头。 GIF; 

我还有以下Application_AcquireRequestState方法

  public void Application_AcquireRequestState(object sender,EventArgs e)
{
//从调用者获取http上下文。
HttpApplication application =(HttpApplication)sender;
HttpContext context = application.Context;

//检查加密查询字符串
string encryptedQueryString = context.Request.QueryString [request];
try
{
if(!string.IsNullOrEmpty(encryptedQueryString))
{
//解密查询字符串
string cryptoKey = System.Web.HttpContext .Current.Session [CryptoKey+ System.Web.HttpContext.Current.Session [UNIQUEKEY]] == null? HttpContext.Current.Application [CryptoKey]。ToString():System.Web.HttpContext.Current.Session [CryptoKey+ System.Web.HttpContext.Current.Session [UNIQUEKEY]]。ToString();
string decryptptedQueryString = CryptoQueryStringHandler.DecryptQueryStrings(encryptedQueryString,cryptoKey);
context.Server.Transfer(context.Request.AppRelativeCurrentExecutionFilePath +?+ decryptptedQueryString);
}
}
catch(Exception ex)
{

}
}
/ pre>

document.getElementById(menu_number).src =<%= HttpContext.Current.Request.ApplicationPath%> / UI /Common/Images/down-arrow.gif; 正在执行,它会在IE 11中引发以下错误。


JavaScript运行时错误:irrationalPath


它还在方法Application_AcquireRequestState中引发异常,但我无法获取例外细节。当我在方法Application_AcquireRequestState中放置一个try-catch时,返回的异常内部消息是


无法评估表达式,因为代码被优化,或本地框架位于调用堆栈的顶部。


我发现很难调试这个。上述一行JavaScript在初始页面加载时成功执行,但在页面加载后点击特定超链接时会抛出该错误。



最可能的原因是: JavaScript错误:irrationalPath
什么是 无法评估表达式,因为代码已被优化,或本机框架位于调用堆栈之上。 实际上是指? >

关于我如何有效地麻烦这个的任何建议?



我已经看到观察到IrrationalPath异常在javascript文件中定义在 http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.3

解决方案

您是否尝试在您的js代码(用两个引号分隔)中使 HttpContext.Current.Request.ApplicationPath 作为字符串。



js代码变成:

  document.getElementById(menu_number).src =< ;%=  ' + HttpContext.Current.Request.ApplicationPath +' %> + / UI /普通/图像/向下arrow.gif; 


In my MasterPage i'm using the following script

<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.3"></script>

And in my application, i have this peace of JavaScript code

document.getElementById(menu_number).src = "<%=HttpContext.Current.Request.ApplicationPath%>/UI/Common/Images/down-arrow.gif";

I also have the Application_AcquireRequestState method below

public void Application_AcquireRequestState(object sender, EventArgs e)
    {
        // Get http context from the caller.
        HttpApplication application = (HttpApplication)sender;
        HttpContext context = application.Context;

        // Check for encrypted query string
        string encryptedQueryString = context.Request.QueryString["request"];
        try
        {
            if (!string.IsNullOrEmpty(encryptedQueryString))
            {
                // Decrypt query strings
                string cryptoKey = System.Web.HttpContext.Current.Session["CryptoKey" + System.Web.HttpContext.Current.Session["UNIQUEKEY"]] == null ? HttpContext.Current.Application["CryptoKey"].ToString() : System.Web.HttpContext.Current.Session["CryptoKey" + System.Web.HttpContext.Current.Session["UNIQUEKEY"]].ToString();
                string decryptedQueryString = CryptoQueryStringHandler.DecryptQueryStrings(encryptedQueryString, cryptoKey);
                context.Server.Transfer(context.Request.AppRelativeCurrentExecutionFilePath + "?" + decryptedQueryString);
            }
        }
        catch (Exception ex)
        {

        }
    }

When document.getElementById(menu_number).src = "<%=HttpContext.Current.Request.ApplicationPath%>/UI/Common/Images/down-arrow.gif"; is being executed, it throws the below error in IE 11.

JavaScript runtime error: irrationalPath

It also throws an exception in method "Application_AcquireRequestState" but i'm not able to get the exception details. When i put a try -- catch in the method "Application_AcquireRequestState", the exception inner message being returned is

Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack.

I'm finding it hard to debug this. The above line of JavaScript executes successfully on the initial page load but throws that error when i'm clicking particular hyperlinks after page load.

What could be the most likely causes of JavaScript error: irrationalPath? And what does "Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack." actually mean?

Any suggestions on how i can effectively troubleshot this?

I have already seen observed that the IrrationalPath exception is defined in the javascript file at http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.3

解决方案

Have you tried to make the HttpContext.Current.Request.ApplicationPath as String in your js code (delimited with two quotes).

js code become :

document.getElementById(menu_number).src = <%="'"+HttpContext.Current.Request.ApplicationPath+"'"%>+"/UI/Common/Images/down-arrow.gif";

这篇关于获取JavaScript运行时错误:irrationalPath,这是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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