[asp.net] Error to use a section registered as allowDefinition='MachineToApplication' beyond application level

It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.

The top line in all of my aspx pages in my /portal/ directory has this error message, and I know it's a common one. I have googled this error message to no end, and I see a lot of posts telling me to configure the /portal/ folder as an application in IIS (which I have), and more posts telling me I have nested web.configs (but none of the postings offer guidance toward a solution).

My setup is that I have a web.config in my root directory, and then I'm trying to make a company portal, in the /portal/directory. The /portal/ directory has its own (necessary) web.config.

My web.config line 50 is like this:

    <customErrors mode="Off" defaultRedirect="customerrorpage.aspx"/>
    <anonymousIdentification enabled="true"/>
    <authentication mode="Forms"/>
    <membership defaultProvider="MyProvider">

So I have domain.com/web.config AND domain.com/portal/web.config ... so my domain.com/portal/default.aspx page will not load.

What is the real solution to this? Do I somehow find a way to merge my root web.config with my /portal/ directory web.config, or am I way off base here?

Any guidance would be greatly appreciated!

This question is related to asp.net web-config

The answer is


Examples related to asp.net

RegisterStartupScript from code behind not working when Update Panel is used You must add a reference to assembly 'netstandard, Version=2.0.0.0 No authenticationScheme was specified, and there was no DefaultChallengeScheme found with default authentification and custom authorization How to use log4net in Asp.net core 2.0 Visual Studio 2017 error: Unable to start program, An operation is not legal in the current state How to create roles in ASP.NET Core and assign them to users? How to handle Uncaught (in promise) DOMException: The play() request was interrupted by a call to pause() ASP.NET Core Web API Authentication Could not load file or assembly 'CrystalDecisions.ReportAppServer.CommLayer, Version=13.0.2000.0 WebForms UnobtrusiveValidationMode requires a ScriptResourceMapping for jquery

Examples related to web-config

No assembly found containing an OwinStartupAttribute Error IIS Config Error - This configuration section cannot be used at this path How to enable GZIP compression in IIS 7.5 how to set start page in webconfig file in asp.net c# Authentication issue when debugging in VS2013 - iis express Forms authentication timeout vs sessionState timeout Specified argument was out of the range of valid values. Parameter name: site Access-control-allow-origin with multiple domains "An exception occurred while processing your request. Additionally, another exception occurred while executing the custom error page..." ASP.NET: HTTP Error 500.19 – Internal Server Error 0x8007000d