Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

web.config allowDefinition=MachineToApplication error

Under the root directory I have the following structure

..
..
..
web.config
Report Folder
- Login.aspx
- Web.config
  |
  |-> ViewReport
       |       
       |-> Report.aspx

In my web.config file in the Report folder I have the following:

    <?xml version="1.0"?>
    <configuration>
        <system.web>
            <authentication mode="Forms">
                <forms loginUrl="Login.aspx" defaultUrl="ViewReport/Report.aspx">
                    <credentials passwordFormat="Clear">
                        <user name="Johl" password="pass888"/>
                    </credentials>
                </forms>
             </authentication>
         </system.web>

        <location path="ViewReport/Report.aspx">
            <system.web>
                <authorization>
                    <allow users="Johl"/>
                    <deny users="*"/>
                </authorization>
            </system.web>
         </location>
     </configuration>

When I start debugging I get the following message:

It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.

NOTE that in my root web.config I have something like the following:

In my root, I already have the following:

         <system.web>        
            <authentication mode="Forms">
                <forms loginUrl="Str/StrUserLogin.aspx" timeout="2880" slidingExpiration="true"  />         
               </authentication>
            <authorization>
                <allow users="*" />
            </authorization>     
         </system.web>
like image 608
Nate Pet Avatar asked Apr 30 '13 19:04

Nate Pet


2 Answers

If you put the published files in inetpub/wwwroot/../ Make sure to add the root folder as an application in IIS Manager.

enter image description here

like image 172
a.karkar Avatar answered Sep 21 '22 12:09

a.karkar


Just add this below lines in your csproject file to clean up the obj/bin folder automatically.

<Target Name="BeforeBuild">
  <!-- Remove obj folder -->
  <RemoveDir Directories="$(BaseIntermediateOutputPath)" />
  <!-- Remove bin folder -->
  <RemoveDir Directories="$(BaseOutputPath)" />
</Target>
like image 38
Kavi Avatar answered Sep 22 '22 12:09

Kavi