Question

Background: ASP.NET Webforms Application with VB.NET backend.

I just recently upgraded from Visual Studio 2010 to Visual Studio 2013 and .NET 4.5.1. This code used to work since we were on Visual Studio 2005 and .NET 2.0. But since the upgrade I am getting this error.

In a ASCX User Control.

<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)%>;
}

We now get this error that we never got before:

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','');

If I play with the file and make a nonsensical change, the error goes away. Example: add a blank line between Line 4 and 5. Then it comes back later.

What could be causing this?

Was it helpful?

Solution

I had the same issue with an old app in iis and when running from visual studio. Disabling browser link in visual studio 2013 seems to fix this. This feature injects some javascript into your page and causes this problem for me at least. Since I disabled it now it works in IIS and from Visual studio.

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

Some more details on the feature here

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

Cheers, Crocked

OTHER TIPS

Disabling browser link in visual studio 2013 fixed this in my case, just uncheck the "Enable Browser Link" in vs (near the Run button)

Ran across this and at first I did not see the where to click because I had the project running.

Here is a screenshot "Disabling browser link in visual studio 2013 seems to fix this. "

enter image description here

I had an incorrect URL in my web application project settings. Updating the setting to use the correct address in my local IIS rectified the issue for me.

The issue arose for me as I had a different virtual directory configured in IIS compared to that specified in the project properties. I also note that opening the reopening the solution automatically creates a working virtual directory automatically in IIS

p

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top