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?
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.
Some more details on the feature here
Cheers, Crocked