Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Security (http://www.velocityreviews.com/forums/f62-asp-net-security.html)
-   -   It is an error to use a section allowDefinition='MachineToApplicat (http://www.velocityreviews.com/forums/t768974-it-is-an-error-to-use-a-section-allowdefinition-machinetoapplicat.html)

Neal Miller 09-19-2006 09:45 PM

It is an error to use a section allowDefinition='MachineToApplicat
 
Hi, I'm getting the following error:

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

I have researched this issue a lot, and can say that:
1) The Application's Path is "C:\Inetpub\wwwroot\Appname".
2) This path is defined as a Virtual Directory in IIS.
3) The Application has a subfolder named "Administration".
4) The "Administration" subfolder is also defined as a Virtual Directory.
5) The web.config file in the Appname folder contains the following text:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"-->
<system.web>
<compilation defaultLanguage="c#" debug="true"/>
<xhtmlConformance mode="Legacy" />
<customErrors mode="Off"/>
<authentication mode="Forms">
<forms timeout="2000">
<credentials passwordFormat="Clear">
<user name="username1" password="pwd1"/>
</credentials>
</forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
<trace enabled="false" requestLimit="10" pageOutput="true"
traceMode="SortByTime" localOnly="false"/>
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false" timeout="2000"/>
<globalization requestEncoding="utf-8" responseEncoding="utf-8"/>
</system.web>
</configuration>

6) The web.config file in the Administration subfolder contains the
following text:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"-->
<system.web>
<compilation defaultLanguage="c#" debug="true"/>
<xhtmlConformance mode="Legacy" />
<customErrors mode="Off"/>
<authorization>
<deny users="?"/>
</authorization>
<trace enabled="false" requestLimit="10" pageOutput="true"
traceMode="SortByTime" localOnly="false"/>
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false" timeout="2000"/>
</system.web>
</configuration>

VS.NET 2005 comes up with the above error on the SessionState line here on
this subfolder's web.config file. If I remove the sessionState section on
this subfolder's web.config file and re-build, then many pre-compile errors
are detected in VS 2005, including many "Error 2 The name 'Global' does not
exist in the current
context C:\Inetpub\wwwroot\Appname\Administration\ReceiveS ystem.aspx.cs 23
", and this error: Warning 1 Invalid search path 'C:\PROGRAM\PCOBOL32'
specified in 'LIB environment variable' -- 'The system cannot find the path
specified. '

If I leave the subfolder's web.config sessionState parameter in it, I only
get the "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." error.

I am aware that sessionState is only supposed to be defined in the top-most
level, but if I do so, I would appreciate any assistance in overcoming the
other errors that I mentioned above.

Thanks in advance.

Neal Miller 09-20-2006 03:02 AM

RE: It is an error to use a section allowDefinition='MachineToApplicat
 
FYI: I resolved the outstanding issue(s).

There were a number of problems in this application, which I converted from
1.1.

1) Multiple web.config files were not necessary. The orig app had them. I
removed all but the web.config in the main folder, and the
"MachineToApplication" error went away.

2) The original programmer coded database access logic in a Global.asax.cs
code-behind file. This does not work very well in 2.0. I moved that common
logic to a new class, then deleted the Global.asax and Global.asax.cs files,
since no other custom logic existed there, converted all code that reference
the former Global. logic to the new class, and that resolved many of the
outstanding issues.

3) I modified all SqlCommand.Parameter.Add logic to use the new 2.0 format
to eliminate many of the deprecated command warnings.

The application now compiles and runs successfully with no errors or warnings.



"Neal Miller" wrote:

> Hi, I'm getting the following error:
>
> "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."
>
> I have researched this issue a lot, and can say that:
> 1) The Application's Path is "C:\Inetpub\wwwroot\Appname".
> 2) This path is defined as a Virtual Directory in IIS.
> 3) The Application has a subfolder named "Administration".
> 4) The "Administration" subfolder is also defined as a Virtual Directory.
> 5) The web.config file in the Appname folder contains the following text:
>
> <?xml version="1.0" encoding="utf-8"?>
> <configuration>
> <!-- xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"-->
> <system.web>
> <compilation defaultLanguage="c#" debug="true"/>
> <xhtmlConformance mode="Legacy" />
> <customErrors mode="Off"/>
> <authentication mode="Forms">
> <forms timeout="2000">
> <credentials passwordFormat="Clear">
> <user name="username1" password="pwd1"/>
> </credentials>
> </forms>
> </authentication>
> <authorization>
> <deny users="?"/>
> </authorization>
> <trace enabled="false" requestLimit="10" pageOutput="true"
> traceMode="SortByTime" localOnly="false"/>
> <sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424"
> sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
> cookieless="false" timeout="2000"/>
> <globalization requestEncoding="utf-8" responseEncoding="utf-8"/>
> </system.web>
> </configuration>
>
> 6) The web.config file in the Administration subfolder contains the
> following text:
>
> <?xml version="1.0" encoding="utf-8"?>
> <configuration>
> <!-- xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"-->
> <system.web>
> <compilation defaultLanguage="c#" debug="true"/>
> <xhtmlConformance mode="Legacy" />
> <customErrors mode="Off"/>
> <authorization>
> <deny users="?"/>
> </authorization>
> <trace enabled="false" requestLimit="10" pageOutput="true"
> traceMode="SortByTime" localOnly="false"/>
> <sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424"
> sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
> cookieless="false" timeout="2000"/>
> </system.web>
> </configuration>
>
> VS.NET 2005 comes up with the above error on the SessionState line here on
> this subfolder's web.config file. If I remove the sessionState section on
> this subfolder's web.config file and re-build, then many pre-compile errors
> are detected in VS 2005, including many "Error 2 The name 'Global' does not
> exist in the current
> context C:\Inetpub\wwwroot\Appname\Administration\ReceiveS ystem.aspx.cs 23
> ", and this error: Warning 1 Invalid search path 'C:\PROGRAM\PCOBOL32'
> specified in 'LIB environment variable' -- 'The system cannot find the path
> specified. '
>
> If I leave the subfolder's web.config sessionState parameter in it, I only
> get the "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." error.
>
> I am aware that sessionState is only supposed to be defined in the top-most
> level, but if I do so, I would appreciate any assistance in overcoming the
> other errors that I mentioned above.
>
> Thanks in advance.



All times are GMT. The time now is 01:07 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.