简体   繁体   中英

How can I set up a virtual directory/application in IIS7 so that it does not inherit any web.config settings?

I have an ASP.NET/IIS 7 web site that is working fine. Now I want to add a classic ASP application to the site in a sub-folder. These are two completely separate applications. One set of users will use the existing ASP.NET app - a different set of users will use the classic ASP app. So I went ahead and created a new folder off of the root and copied the classic ASP app there. When I tried to visit the default page of the classic ASP app, I got redirected to the Login page (because of the web.config settings in my ASP.NET app). So I converted the folder for the classic ASP app to an application. That took care of the Login issue. But now I am getting errors regarding a Custom Role Provider that I am using in the ASP.NET app.

I am guessing that somehow I need to set up my classic ASP app so that it doesn't inherit anything from the web.config of the main ASP.NET app. Am I thinking about this correctly?

Does anyone have any other ideas about the best way to add a legacy ASP application to a ASP.NET site?

Thanks, Corey

Using clear should work, but if you should encounter more unwanted inherited settings, you could choose to disable inheritance of all web config settings to all application folders below the root folder by editing the web.config in the root directory and insert a location element with a inheritInChildApplications attribute set to false.

<?xml version="1.0"?>
<configuration>
    <location path="." inheritInChildApplications="false"> 
    <!--old web.config elements in root of site -->
    </location>
</configuration>

Does the classic ASP site have a web.config file? If not I think you should be able to add one.

Then, for each section in the web.config file where the classic ASP site has inherited some settings you should be able to add a <clear /> tag to remove anything defined further up the chain.

So for example, to clear the custom role provider your classic ASP web.config should look something like this:

<roleManager ...>
    <providers>
        <clear/>
    </providers>
</roleManager>

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM