Two Web.config file in a project

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ravishankar81
    New Member
    • Oct 2007
    • 1

    Two Web.config file in a project

    Hi

    I Want to know that Why we need to put two web.config file in web project.
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Question mived to .NET Forum.

    Comment

    • Shashi Sadasivan
      Recognized Expert Top Contributor
      • Aug 2007
      • 1435

      #3
      you can have only one we.config in your directory
      which means any children directory can have a web.config within them

      It is like creating your settings for the application,
      and then setting individual settings / overide settings for certain groups.

      However you can have only one web .config in each directory

      Comment

      • bhar
        Banned
        New Member
        • Apr 2006
        • 37

        #4
        Hi,

        Consider a Web site structure

        Application Root

        Sub Drec1

        Sub Dir2


        From the above fig, the application root directory is the virtual directory of the web site. A virtual directory is the main directory of a web site. This virtual directory contains all the files , subdirectories and other resources of a web site. Every web site needs to have a virtual directory and the virtual directory might contain subdirectories within it. The two ditectories sub dir1 and sub dir2 that exist within application root directory are not virtual directories.

        The default settings of the machine-level configuration file, that is , machine.config allow access to all users, and all ASP.net directories and subdirectories inherit settings from this machine.config file. However, if an application has a configuration file in its application root directory, it overrides the default settings of the machine.config file. Therefore, if a Web site has no configuration file in its application root directory, when the browser requests the Web site, all users will be given access to the ASP.net resources on the Web site.

        In the above file structure, there is no configuration file in the application root directory. Therefore, the configuration settings for the machine.config file are applied to the entire file structure of the Web site.

        However, if a Web.config file exists in a subdirectory of a Web site, the settings in the Web.config file of the sub directory override the settings of the machine.config file. For example, if there is a Web.config file in subdire2 with settings that specify access to certain users only, then all users will have access to the ASP.net resources in the application root directory but only certain users have access to the resources in sub directory Sub dir2.
        Last edited by pbmods; Oct 22 '07, 11:52 AM. Reason: Removed link.

        Comment

        Working...