locked
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. RRS feed

  • Question

  • User-1106011126 posted

    I have got this error which recurred many times about 18 months ago when I first began.  I have a web site running from a menu and at the time I first encountered this error,

    I found the solution to be removing the web.config filefrom any sub-folders in the site.  Now I am trying to pass controls from one task to another.  To do this I need a call to RESPONSE.REDIRECT.  I fussed with this but somehow I could not make it link correctly.  I have concluded that I am lacking some basic information and definitions.  I tried to first see if I could make a simple hyperlink work and here is where I've run into the problem above.  What I have is a page called newbase which has a hyperlink to "newbaserec" that does nothin but display "SUCCESS"

    Without doing anything beyond the above, I get the crash with the famous caption:

    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.

    The hyperlink code is right from my toolbox and the navigation property is set properly to be default.aspx in my second folder.  I took out the web.config files out of both folders and it apparently worked to get rid of the problem but now I am getting a different problem which evidently stems from removing the web.config.

    Could not load type 'NEWBASEREC._Default'.
    Line 1:  <%@ Page Title="Home Page" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false"
    Line 2: CodeBehind="Default.aspx.vb" Inherits="NEWBASEREC._Default" %> Line 3:

    Now what do I do?   Hyperlinks work on my site when I employ them via html commands.  I do not understand several items such as configuring in IIS, but thats a question for another day.  Can someone help me on this?

    Thursday, May 8, 2014 5:53 PM

Answers

  • User-1106011126 posted

    I am sorry but the answer you give me does not register with me.  I found that by removing the inherits clause from the code, I was able to proceed without objection.  I was able to discover something else with respect to the original question I posed.  Things just don't seem to work when the hyperlink target is in a folder that is below my root level.  When I move the basic files up to my root level, everything seems to work!  Cannot explain why.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 9, 2014 6:22 PM

All replies

  • User-1716253493 posted

    Inherits and class name should match

    i.e :

    Partial Class NEWBASEREC._Default
        Inherits System.Web.UI.Page
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    
        End Sub
    End Class

    Thursday, May 8, 2014 8:47 PM
  • User-1106011126 posted

    I am sorry but the answer you give me does not register with me.  I found that by removing the inherits clause from the code, I was able to proceed without objection.  I was able to discover something else with respect to the original question I posed.  Things just don't seem to work when the hyperlink target is in a folder that is below my root level.  When I move the basic files up to my root level, everything seems to work!  Cannot explain why.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, May 9, 2014 6:22 PM
  • User-1716253493 posted

    If i'am not wrong understand,

    Make all subfolder/virtual directory under one application (without web.config)

    To access another folder use "~/" (root) as link based

    i.e : NavigateUrl = "~/newbaserec/test.aspx"

    or response.rediect("~/newbaserec/test.aspx")

    "~/" is the application root.

    Friday, May 9, 2014 8:43 PM
  • User-1106011126 posted

    Thank you for the clarification

    Saturday, May 10, 2014 5:26 PM