asp.net - VirtualPath 在当前应用程序根目录之外

标签 asp.net webforms visual-studio-2013 browser-link

背景:
带有 VB.NET 后端的 ASP.NET Webforms 应用程序。

我刚刚从 Visual Studio 2010 升级到 Visual Studio 2013 和 .NET 4.5.1。自从我们使用 Visual Studio 2005 和 .NET 2.0 以来,此代码就一直有效。但是自从升级以来,我收到了这个错误。

在 ASCX 用户控件中。

<script language="javascript" type="text/javascript">
<!--
function SetItem_<%Response.Write(m_strJSAlias)%>(strValue) {
     $("#<%Response.Write(txtShop.ClientID)%>").attr('value',strValue);
    __doPostBack('frmCorpPortal_Form','');
    void FocusOnNext_<%response.Write(m_strJSAlias)%>;
}

我们现在得到了这个以前从未遇到过的错误:
VirtualPath was outside the current application root.
Parameter name: virtualPath 
Description: An unhandled exception occurred during the execution of the current web request.    Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentException: VirtualPath was outside the current application root.
Parameter name: virtualPath


Line 4:  <script language="javascript" type="text/javascript">
Line 5:  <!--
Line 6:  function SetItem_<%Response.Write(m_strJSAlias)%>(strValue) {
Line 7:       $("#<%Response.Write(txtShop.ClientID)%>").attr('value',strValue);
Line 8:      __doPostBack('frmCorpPortal_Form','');

如果我使用文件并进行无意义的更改,错误就会消失。示例:在第 4 行和第 5 行之间添加一个空行。然后它稍后会回来。

这可能是什么原因造成的?

最佳答案

我在 iis 中的旧应用程序以及从 Visual Studio 运行时遇到了同样的问题。在 Visual Studio 2013 中禁用浏览器链接似乎可以解决此问题。此功能将一些 javascript 注入(inject)您的页面并至少对我造成此问题。因为我现在禁用了它,所以它可以在 IIS 和 Visual Studio 中工作。

http://techatplay.wordpress.com/2013/10/24/vs2013-asp-net-application-error-virtualpath-was-outside-the-current-application-root/

有关该功能的更多详细信息here

http://blogs.msdn.com/b/webdev/archive/2013/06/28/browser-link-feature-in-visual-studio-preview-2013.aspx

干杯,
摩擦

关于asp.net - VirtualPath 在当前应用程序根目录之外,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19669456/

相关文章:

c# - 更新到 beta8 后无法发布 asp.net 5 应用程序 - 依赖项......无法解决

asp.net - Orchard CMS 应用程序内的 WebForms 页面

asp.net - 将基于 ASp.net Webform 的网站迁移到 Microsoft Azure

visual-studio-2013 - Visual Studio 2013 网站刷新/重启忽略代码更改

c# - 从 MVC 区域重定向将我重定向到顶级操作?

c# - 如何从 Facebook 获取阿拉伯语的帖子

javascript - 尝试使用 JSON 获取级联 DDL 但未得到响应

c# - 将纯 HTML 网格改造为 C# 网格

c# - 如何在浏览代码时显示<returns>内容?

c++ - VS2013 - 多次包含同一 header 时出错