ASP.NET: Web.config in Account folder

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
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s