Using multiple web.config files...

  • Thread starter Thread starter Andrew Connell
  • Start date Start date
A

Andrew Connell

I have an app where I want virtually everything password protected/secure except for a single directory. That directory handles some custom authentication and contains my login form, but also some other pages that I need to make available to anon users.

I've setup my web.config in the root directory to have the following included:
<authentication mode="Forms">
<forms name=".ASPXFORMSAUTH" path="/" loginUrl="portalAuthentication/outbound.aspx" protection="All" timeout="30"></forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>

What I want to do is set the directory 'portalAuthentication' to let anyone have access. I added a second web.config with the following:
<authentication mode="None" />
<authorization>
<allow users="*"/>
</authorization>
Everything was working fine with the single web.config in the root directory, but when I added the second to the 'portalAuthentication' directory, I started getting the error:
Parser Error 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.
My root directory is setup correctly within IIS. I'm fairly certain I didn't have to create additional vdir/applications for the portalAuthentication directory. Any ideas?
 
What you want is DataGrid1.BackColor property it takes a Color enum such as
Color.Red
regards

--


-----------
Got TidBits?
Get it here: www.networkip.net/tidbits/default.htm

I have an app where I want virtually everything password protected/secure
except for a single directory. That directory handles some custom
authentication and contains my login form, but also some other pages that I
need to make available to anon users.

I've setup my web.config in the root directory to have the following
included:
<authentication mode="Forms">
<forms name=".ASPXFORMSAUTH" path="/"
loginUrl="portalAuthentication/outbound.aspx" protection="All"
timeout="30"></forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>

What I want to do is set the directory 'portalAuthentication' to let anyone
have access. I added a second web.config with the following:
<authentication mode="None" />
<authorization>
<allow users="*"/>
</authorization>
Everything was working fine with the single web.config in the root
directory, but when I added the second to the 'portalAuthentication'
directory, I started getting the error:
Parser Error 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.
My root directory is setup correctly within IIS. I'm fairly certain I
didn't have to create additional vdir/applications for the
portalAuthentication directory. Any ideas?
 
You can't use multiple config files in a single application. Instead, you
need to create (one or more) <location> sections in your root Web.Config.

Jerry

I have an app where I want virtually everything password protected/secure
except for a single directory. That directory handles some custom
authentication and contains my login form, but also some other pages that I
need to make available to anon users.

I've setup my web.config in the root directory to have the following
included:
<authentication mode="Forms">
<forms name=".ASPXFORMSAUTH" path="/"
loginUrl="portalAuthentication/outbound.aspx" protection="All"
timeout="30"></forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>

What I want to do is set the directory 'portalAuthentication' to let anyone
have access. I added a second web.config with the following:
<authentication mode="None" />
<authorization>
<allow users="*"/>
</authorization>
Everything was working fine with the single web.config in the root
directory, but when I added the second to the 'portalAuthentication'
directory, I started getting the error:
Parser Error 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.
My root directory is setup correctly within IIS. I'm fairly certain I
didn't have to create additional vdir/applications for the
portalAuthentication directory. Any ideas?
 
Jerry III said:
You can't use multiple config files in a single application. Instead, you
need to create (one or more) <location> sections in your root Web.Config.

This turns out not to be the case. You can use multiple config files in a
single application.

What you can't do is use the <authentication> element, which is "registered
as allowDefinition='MachineToApplication'" in your subfolder, which is not
an application. Just remove <authentication> and you'll be alright.
 
Back
Top