11

I've opened an existing web application project from Visual Studio 2013 (which runs just fine), in Visual Studio 2015. When I run it from within Visual Studio 2015 I get:

Active Server Pages error 'ASP 0131' 

Disallowed Parent Path 

/blah/login.asp, line 1 

The Include file '../includes/Security.asp' cannot contain '..' to indicate the parent directory. 

My IISExpress applicationhost.config file already contains the entry:

<asp appAllowClientDebug="false" appAllowDebugging="false" errorsToNTLog="false" enableParentPaths="true" scriptErrorSentToBrowser="true" bufferingOn="true">

            <session allowSessionState="true" />
            <cache diskTemplateCacheDirectory="%SystemDrive%\inetpub\temp\ASP Compiled Templates" />
            <limits maxRequestEntityAllowed="1073741824" />
        </asp>

My web application properties are set to use IISExpress.

What could I be missing?

TrevorBrooks
  • 3,590
  • 3
  • 31
  • 53

3 Answers3

12

The 'applicationhost.config' has moved and is now located in the hidden .vs folder. Make sure you're updating the right file.

thllbrg
  • 2,017
  • 17
  • 21
  • Where is the hidden vs folder? – TrevorBrooks Jul 29 '15 at 16:16
  • 1
    At the root of your project – thllbrg Jul 29 '15 at 16:35
  • 1
    Just to clarify, as I'll be making a similar move soon, is this hidden folder present in vs2013? or will I need to wait until after I upgrade to 2015 to make similar changes? And am I understanding correctly that when you hit f5 in vs2015, is it referencing only the new location? or do changes now need to be made in both the old and new location of applicationhost.config? – Jon Jul 30 '15 at 16:16
  • This worked for me on VS2017 so thank you. Right Click IISExpress icon in the task pane, click on the config link, scroll down to system.webserver asp section and add in enableParentPaths="true". – K7Buoy Jul 05 '17 at 11:14
5

Here is a much clear explaination although the accepted answer is in the right direction.

Since VS2015, IIS Express has changed where it picks up your applicationHost.config file. This is presumably to simplify the distribution of projects. It has moved away from the traditional C:\Users\<profile>\Documents\IISExpress\config\applicationhost.config folder (although this file will still exist on your computer to support older VS installations).

It is now located in the application project's root folder as a hidden file. To save you hunting for it, here is how you open it quickly and easily:

  1. Right click IIS Express from the tray icon and select Show All Applications.
  2. Click on the URL entry of your application. The "Path" and "Config" values then are shown as hypertext links further down in the IIS Express window.
  3. Click on the Config hypertext to open on your preferred editor. (e.g. C:\<Path-To-Project>\.vs\config\applicationhost.config)

Hope this helps.

Chris Walsh
  • 3,423
  • 2
  • 42
  • 62
2

I wanted to add my version of a very similar answer because I still had to do some searching to get the expected end results. Although the original question just really wanted to know why the current config that was being used was not working and it was in fact explained in the accepted answer, it did not help someone like me coming into the question. I needed to know everything to do in order to achieve allowing parent paths when debugging. So here is my answer in detail...

How to configure the IIS debug server in Visual Studio 2015 to allow parent paths:

First you need to find the IIS Express tray icon.

iis_tray_icon

Next you need to open the IIS config currently running for debugging by right clicking on that tray icon. You will then see the following context menu. You will need to click on "Show All Applications".

iis_tray_content_menu

This will then show you the configurations of the IIS debug server you are running. There will also be the project you are working on listed in this list.

iis_config_window

Click the projects name (in this case "Web") under the Site Name column. You will then see the Path of the project and the Config file being use to run the debug IIS server. You will then click on the Config path to open the applicationhost.config in your default text editor.

iis_config_window_project_selected

This will open up the config file you are using when debugging your project. You will need to scroll down until you find the <system.webServer> section. Then look for the <asp> section. In my case it was <asp scriptErrorSentToBrowser="true">.

iis_applicationhost_config

Then you just need to edit the asp section to include enableParentPaths="True" as shown in the image below.

iis_applicationhost_config_edited

The just save the file and restart the debugging process. Note: I only had to hit F5 in the IE browser to see the change. I did not have to close the browser and restart the debug process over again.

Arvo Bowen
  • 4,524
  • 6
  • 51
  • 109