0

My Account Pages(Login, Registration, etc.) are using the Site.Master of the root directory. Since Parent Paths are disabled by default(?) I get the following famous error:

Cannot use a leading .. to exit above the top directory.

I have found a very promising solution on stackoverflow but didn't work for me

iis-express-and-classic-asp

Here is the regarding part:

<system.webServer>

    <serverRuntime />

    <asp 
    enableParentPaths="true" 
    scriptErrorSentToBrowser="true">
        <cache diskTemplateCacheDirectory="%TEMP%\iisexpress\ASP Compiled Templates" />
        <limits />
    </asp>

    <caching enabled="true" enableKernelCache="true">
    </caching>

    <cgi />

    <defaultDocument enabled="true">
        <files>
            <add value="Default.htm" />

            ...
            ...
            ...

Do you have any other suggestions? I am googling it since hours but couldn't find anything useful. Actually If I create a separate Master Page for the Account Pages then I don't get any error since It doesn't try to go to upper directory but I don't need any other Master page and think there should be a more appropriate solution.

Community
  • 1
  • 1
mctuna
  • 809
  • 3
  • 19
  • 38
  • I haven't used IIS Express with classic ASP but in regular IIS it's easy to enable ASP Parent Paths (http://prashantd.wordpress.com/2010/06/22/iis-7-5-enable-parent-paths-for-asp/). Maybe if you can get your hands on regular IIS it might solve your problem. – sakura-bloom Nov 20 '13 at 22:41
  • yes, you can even achieve that by configuration wizard I guess, at worst case, I will carry the site to the normal regular IIS – mctuna Nov 23 '13 at 12:52

3 Answers3

3

I had the same Issue in Visual Studio 2012 - here's my solution:

<system.webServer>
  <asp enableParentPaths="true" />
</system.webServer>

Was required, but led to the error message HTTP/1.1 New Application Failed. I also had to change the overrideModeDefault in C:\Users\[Username]\Documents\IISExpress\config\applicationhost.config from Deny to Allow

<sectionGroup name="system.webServer">
  <section name="asp" overrideModeDefault="Allow" />
  ...

That did it :-)

  • In case someone ends up here like I first did, [This is a post](https://stackoverflow.com/a/51525243/1039753) for a detailed explanation of what I had to do for Visual Studio 2015. – Arvo Bowen Jul 25 '18 at 23:02
0

Althoug it didn't solve my problem, I just wanted to share the right way of adding enableParentPaths right way.

I guess this following part, since it is not enclosed by "location path='Website name'", is valid for whole asp.net projects:

<system.webServer>

<serverRuntime />

<asp 
enableParentPaths="true" 
scriptErrorSentToBrowser="true">
    <cache diskTemplateCacheDirectory="%TEMP%\iisexpress\ASP Compiled Templates" />
    <limits />
</asp>

<caching enabled="true" enableKernelCache="true">
</caching>

<cgi />

<defaultDocument enabled="true">
    <files>
        <add value="Default.htm" />

        ...
        ...
        ...

If enableParentPaths or any other option is wanted to be added just for a specific website, we have to run that code on the command prompt:

appcmd.exe set config "Website Name" -section:system.webServer/asp /enableParentPaths:"False" /commit:apphost

Since I somehow didn't have "location" section specific for my project, this command added up the following section by at the end of my applicationhost.config.

</location>
<location path="Medical_BootStrap">
    <system.webServer>
      <asp appAllowClientDebug="true" appAllowDebugging="true" errorsToNTLog="true" enableParentPaths="true" scriptErrorSentToBrowser="true" bufferingOn="true">

        <session allowSessionState="true" />
        <cache diskTemplateCacheDirectory="%TEMP%\iisexpress\ASP Compiled Templates" />
        <limits />
      </asp>
    </system.webServer>
</location>

I thought it would be useful for the ones who want to add it right way just for the necessary website.

mctuna
  • 809
  • 3
  • 19
  • 38
0

I've recently encountered a similar problem, so perhaps this can help you. If you use the /path: command line option of IIS Express, it ignores the settings in applicationhost.config. The solution is to create a new WebSite section, like this:

        <site name="YourApplication" id="12345" serverAutoStart="true">
            <application path="/" applicationPool="Clr2IntegratedAppPool">
                <virtualDirectory path="/" physicalPath="C:\Path\To\Your\Application" />
            </application>
            <bindings>
                <binding protocol="http" bindingInformation=":8080:localhost" />
            </bindings>
        </site>

And then run IIS Express with /site:YourApplication command line instead of /path:.

SlugFiller
  • 1,596
  • 12
  • 12