ASP.NET 4.0 error – The relative virtual path ‘aspnet_client/WebForms.js’ is not allowed here

Sometimes when hen we try to convert ASP.NET application from .NET framework 2.0 to latest 4.0. It goes all good with .NET framework 4.0 but whenever we try to execute the application, we get the following error.

[wpfmb type=’error’ theme=2]The relative virtual path ‘aspnet_client/WebForms.js’ is not allowed here[/wpfmb]

Are you using <webControls /> in your web.config this might cause the above error

Go to your web.config file and try to find something like this:

<webControls clientScriptsLocation="aspnet_client/"/>

Delete or comment this line and error will be fixed.