Can we create a different config file ?

Posted by Akiii under ASP.NET on 10/26/2011 | Points: 10 | Views : 1418 | Status : [Member] | Replies : 6
Hi all,
When we create a web application, by default a web.config file is created in the root folder. We can write custom values in this file.

We normally write in web.config file like this :-
<appSettings>
<add key="Theme1" value="Akiii"/>
</appSettings>


And, we get this in our code by using :-
string strName = ConfigurationSettings.AppSettings["Theme1"];


Now my question is can we create a config file with different name like Flower.config file in the root directory ? If yes, then how to refer to this Flower.config file in applications ?

Any help is appreciated
Thanks and Regards
Akiii




Responses

Posted by: Avdesh on: 10/26/2011 [Member] Starter | Points: 25

Up
0
Down
No, you cannot rename the web.config file. Out of curiosity, why do you want to rename it? Even if you rename the existing web.cofig file and run your web application, a default web.config will be added to your solution automatically.

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 10/26/2011 [Member] Bronze | Points: 25

Up
0
Down
hi Avdesh,
Thanks for replying...
I am not talking abt making a same web.config file, i am talking abt making a config file with a different name and how to use it ?

Regards
Akiii


Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sriramnandha on: 10/27/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,

U cannot Rename the web.Config file beacuse its .Net Integration File.its already Bulidin file..if u r reanme its default create web.Confif file in u r application..


Regards
Sriram.R




sriram

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 10/27/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi Sriram,
I dont want to rename the web.config file, i want to build another config file with a different name....can i do it ?

Akiii

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bees7000 on: 10/28/2011 [Member] Starter | Points: 25

Up
0
Down
hi
yes You Can Create Another Config File

Marwan

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Akiii on: 10/28/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi Marwan,
Thanks for ur reply. Could you please tell me how to access that config file ?

Regards
Akiii

Akiii, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response