VirtualPath在当前应用程序根目录之外

Ken*_*Ard 35 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)%>;
}
Run Code Online (Sandbox Code Playgroud)

我们现在得到了以前从未得到过的错误:

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','');
Run Code Online (Sandbox Code Playgroud)

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

可能是什么导致了这个?

Cro*_*ked 88

在iis中以及从visual studio运行时,我遇到了同样的问题.在visual studio 2013中禁用浏览器链接似乎解决了这个问题.此功能会将一些javascript注入您的页面,至少会对我造成这个问题.因为我现在禁用它它在IIS和Visual Studio中工作.

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

有关此功能的更多详细信息

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

干杯,Crocked

  • +1这是使用Visual Studio 2013年时,**禁用浏览器链接**只需点击工具栏上的浏览器链接刷新箭头到底是什么造成了这个问题对我来说,取消选中'启用浏览器Link`. (6认同)
  • 要禁用浏览器链接,您可能需要插入到web.config appSettings <add key ="vs:EnableBrowserLink"value ="false"/> (2认同)

小智 5

在我的案例中禁用visual studio 2013中的浏览器链接,只需取消选中vs中的"启用浏览器链接"(在"运行"按钮附近)