Asp.net VirtualPath位于当前应用程序根目录之外

Asp.net VirtualPath位于当前应用程序根目录之外,asp.net,webforms,visual-studio-2013,browser-link,Asp.net,Webforms,Visual Studio 2013,Browser Link,背景: 带有VB.NET后端的ASP.NET Webforms应用程序 我最近刚从Visual Studio 2010升级到Visual Studio 2013和.NET 4.5.1。自从我们使用VisualStudio2005和.NET2.0以来,这段代码就一直有效。但是自从升级后,我得到了这个错误 在ASCX用户控件中 <script language="javascript" type="text/javascript"> <!-- function SetItem_&l

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

我最近刚从Visual Studio 2010升级到Visual Studio 2013和.NET 4.5.1。自从我们使用VisualStudio2005和.NET2.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)%>;
}


我在iis中的一个旧应用程序以及从visual studio运行时也遇到了同样的问题。在visual studio 2013中禁用浏览器链接似乎可以解决此问题。这个特性将一些javascript注入到您的页面中,至少对我来说会导致这个问题。由于我禁用了它,现在它可以在IIS和Visual studio中工作

有关此功能的更多详细信息,请参见此处

干杯,
Crocked

在visual studio 2013中禁用浏览器链接修复了我的问题,只需取消选中vs中的“启用浏览器链接”(靠近运行按钮)

我的web应用程序项目设置中的URL不正确。更新设置以在本地IIS中使用正确的地址为我解决了此问题

问题出现在我身上,因为我在IIS中配置的虚拟目录与在项目属性中指定的不同。我还注意到,打开重新打开解决方案会自动在IIS中创建一个工作虚拟目录


p

遇到了这个问题,起初我没有看到要单击的位置,因为我正在运行项目

这是一个截图 “在visual studio 2013中禁用浏览器链接似乎可以解决此问题。”


这可能是因为老派不使用+1。多亏了你,我只花了5秒钟就解决了这个问题,而不是用谷歌搜索了5个小时。这个答案应该作为一个答案进行检查。+1这正是我在使用Visual Studio 2013时遇到问题的原因。要禁用浏览器链接,只需单击工具栏中的浏览器链接刷新箭头并取消选中
启用浏览器链接
。要禁用浏览器链接,您可能需要插入web.config appSettings设置以禁用浏览器链接在我的情况下--我实际上没有调试任何内容,因此我无论如何都不需要该设置:)
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','');