you can always have more then one web.config inside an application/site provided that they resides one in a sub directory.
suppose you have a web site named: testsite, inside you have two folders, one is Account second is Registration. account folder contains some .aspx/.aspx.cs files same with the registration. now you want to have some configuration settings for Accounts folder and some other settings for Registration folder, so in such case by right clicking on the Account folder >> Add new item, and then selecting the configuration file you can create settings inside the web.cofig file specially for Account folder, and with same ways you can add a new web.config for your Registration Folder.
Now when you'll fetch the key value or any other setting with ConfigurationManager.AppSettings["key"].ToString(), it will bring the return from current directory config files.
so in whichever directory you are working on and trying to retrieve config file values from there it will check the current web.config first, if it wont find it, it'll then go one level up to find it.
i hope it'll help
No comments:
Post a Comment