Web application with multiple web.configs
I am working on a web application that has multiple folders and its pages in a web project. There is also a web.config will all the traditional tags. I had to create another folder called customerportal, in the folder I created 3 pages customerlogin.aspx
, customerdefault.aspx
and customerhelp.aspx
. I also added 3 folders, images, css and scripts to this folder.
Now when I go to this folder say http://mysite.com/customerportal/customerlogin.aspx
it works fine. I added the file web.config
because now I only need to find this folder for client roles and also I need to restrict the main application (parent) to the client role. Thus, the client cannot get to the client portal, and the portal user cannot get to the application master pages. So I added a checkbox that restricts the roles in the child web.config.
, it didn't work as I was told that
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.
So, I converted the folder to a virtual directory and then to an application in iis. Then the error went away, but I ran into other problems like main things web.config
inherited from child web.config
. So I started investigating and I saw a lot of answers such as:
put a <location path="." inheritInChildApplications="false">
in front of the section <system.web>
, i tried this, but now i get an error in the tag <membership>
. The membership is in a different aspmembership database, so the child has a different connection string, etc. But I cannot do something like
<membership>
<clear />
or a <membership> <remove name=..>
The kind of membership is still inherited. What is the best way to solve this problem with child.config? What's the best practice for this kind of setup when the child folder needs its own web.config? This is the first time I do this.
source to share