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

Rate It (8)

Last post 12-02-2009 4:32 AM by Gadiputi sudhir. 46 replies.

Sort Posts:

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

    12-10-2004, 2:23 AM
    • Star
      12,063 point Star
    • ranganh
    • Member since 02-11-2004, 11:35 PM
    • India
    • Posts 2,428

    You may get this error when trying to browse an asp.net application.

    The debug information shows that "This error can be caused by a virtual directory not being configured as an application in IIS."

    However, this error occurs primarily out of 2 scenarios.

    1. When you create an new web application using visual studio.net, it automatically creates the virtual directory and configures it as an application. However, if you manually create the virtual directory and it is not configured as an application, then you will not be able to browse the application and may get the above error. The debug information you get as mentioned above, is applicable to this scenario.

    To resolve it, Right Click on the virtual directory - select properties and then click on
    "Create" next to the "Application" Label and the textbox. It will automatically create the "application" using the virtual directory's name. Now the application can be accessed.


    2. When you have sub-directories in your application, you can have web.config file for the sub-directory. However, there are certain properties which cannot be set in the web.config of the sub-directory such as authentication, session state (you may see that the error message shows the line number where the authentication or sessionstate is declared in the web.config of the sub-directory). The reason is, these settings cannot be overridden at the sub-directory level unless the sub-directory is also configured as an application (as mentioned in the above point).

    Mostly we have the practice of adding web.config in the sub-directory if we want to protect access to the sub-directory files (say, the directory is admin and we wish to protect the admin pages from unathorized users).

    But actually, this can be achieved in the web.config at the application's root level itself, by specifing the location path tags and authorization, as follows:-


    <location path="Admin">
    <system.web>
    <authorization>
    <allow roles="administrators" />
    <deny users="*" />
    </authorization>
    </system.web>
    </location>


    However, if you wish to have a web.config at the sub-directory level and protect the sub-directory, you can just specify the Authorization mode as follows:-


    <configuration>
    <system.web>
    <authorization>
    <allow roles="administrators" />
    <deny users="*" />
    </authorization>
    </system.web>
    </configuration>


    Thus you can protect the sub-directory from unauthorized access.

    Cheers.
    regards,
    Harish

    http://geekswithblogs.net/ranganh
  • Smile [:)] Re: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level

    09-23-2005, 3:37 AM
    • Member
      5 point Member
    • sanju
    • Member since 09-22-2005, 8:11 AM
    • india
    • Posts 1
    when  i move web.conf file from subdirectory to root.This error is gone Smile [:)].But i want to keep the config file in subdirectory only i tried all those methods given in last post .but no use .pl help meSad [:(]

    sanju
  • Re: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level

    09-26-2005, 12:53 AM
    • Star
      12,063 point Star
    • ranganh
    • Member since 02-11-2004, 11:35 PM
    • India
    • Posts 2,428
    Dear sanju,

    You cannot keep the web.config only in the sub-directory.  You need to have a web.config in the root directory.  If at all you want to have a web.config in the sub-directory, then the only settings you can specify are authorization, appsettings etc.,

    Unless you configure the sub-directory also as an application in the IIS Virtual directory settings, you cannot have any other settings such as authentication, session-state etc., in the web.config that you have in the sub-directory.

    Hope that makes it clear.

    Thanks.
    regards,
    Harish

    http://geekswithblogs.net/ranganh
  • Re: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level

    10-29-2005, 4:26 PM
    • Member
      5 point Member
    • andrewk
    • Member since 10-29-2005, 8:19 PM
    • Posts 1

    I had the same error and solved it by doing the following:

    Give your virtual directory an Application Name that does not have dots (.) in the name. To make sure you are not having naming issues, give a short name such as MK as your Virtual Directory name.

    After doing this, this problem was solved.

    Andrew

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

    12-05-2005, 12:45 PM

    ranganh wrote:
    Dear sanju,

    You cannot keep the web.config only in the sub-directory.  You need to have a web.config in the root directory.  If at all you want to have a web.config in the sub-directory, then the only settings you can specify are authorization, appsettings etc.,

    Unless you configure the sub-directory also as an application in the IIS Virtual directory settings, you cannot have any other settings such as authentication, session-state etc., in the web.config that you have in the sub-directory.

    Hope that makes it clear.

    Thanks.

     

    Awesome thread gents/ladies!  I pulled this up in Google since I'm a new ASP 2.0 User.  This remedied my issue.  Thank you.

    Jon

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

    01-08-2006, 9:48 PM
    • Contributor
      2,724 point Contributor
    • dba123
    • Member since 12-13-2003, 12:04 AM
    • Posts 1,331

    When is Microsoft going to get rid of VB.NET!
  • Re: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level

    01-18-2006, 3:31 AM
    • Member
      117 point Member
    • nizdon
    • Member since 11-25-2005, 1:02 PM
    • Posts 24

    I am also getting same error  when i am using the asp.net user controls in sahrepoint webparts.

    "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"

    But my virtual directory is configured. and i am  able to run the asp.net solution which consists of user controls with out any errors.

     

    I am getting the error only when i am using these usercontrols in creating webparts

    Help me

    Nizdon

     

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

    04-13-2006, 12:59 PM
    • Member
      15 point Member
    • Mickster
    • Member since 07-06-2005, 10:41 AM
    • Posts 3

    Hi

    That worked great thanks.Big Smile [:D]

    mickster

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

    06-02-2007, 9:04 AM
    Thanks for greate help while I move the Subfolder webconfig Contents to the Main folder it works great.:)
  • Re: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level

    09-06-2007, 8:44 AM
    • Member
      25 point Member
    • needo001
    • Member since 08-16-2007, 10:14 AM
    • Germany
    • Posts 26

    Thnaks buddy it helped

    Khan, SharePoint Developer
  • Re: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level

    10-08-2007, 6:12 AM

    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

     

    Even i was also facing this problem... and the root of the problem was that i had one duplicate web.config file in a subfolder.... As i removed that file error has been gone... Many Thanks.... 

    Please MARK post as ANSWERED, if you find answer helpful
    http://www.linkedin.com/in/shantanushukla
    Filed under:
  • Re: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level

    10-11-2007, 4:45 PM

    Awesome solution guy. I struggled for 8 hrs and ultimately i resolved by following the "ranganh" solution.

     Thanks, Man :)

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

    11-16-2007, 12:15 AM
    • Member
      236 point Member
    • Lunch2000
    • Member since 01-12-2003, 6:43 PM
    • Posts 60

    I had the same problem, but what I did to solve it was instead of opening up the solution file (AjaxControlToolkit.sln) I just selected "Open Web Site" from the file menu and clicked on the SampleWebSite folder.  I imagine that the problem had something to do with confusing the web.config files from the other projects.

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

    12-05-2007, 7:28 AM
    • Member
      85 point Member
    • Jay Khanpara
    • Member since 05-15-2007, 10:36 AM
    • Banaglore
    • Posts 41

    Hi,

    I am having problem regardign registry. I have created my application on WinXP Profession where I am having IIS. But when I have copied entire code to other machine where XP Home is running with IIS, I am not able to run the application.

     Can anybody help me out?

     

    Regards,

    Jay Khanpara



    Regards,
    Jay Khanpara
  • Re: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level

    12-19-2007, 10:57 AM

    where is this virtual directory for purposes of clicking on it?

    -Tab Alleman
Page 1 of 4 (47 items) 1 2 3 4 Next >