Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I create .config file and include it to web.config?

Tags:

asp.net

config

Can I create .config file and include it to web.config? How can i do this?

UPD. If you want to separate config file, for example, move appSettings to another file you must do next: In web.config

  <appSettings configSource="myAppSettings.config" /> 

In myAppSettings.config:

  <appSettings>     <add key="ClientValidationEnabled" value="true" />     <add key="UnobtrusiveJavaScriptEnabled" value="true" />   </appSettings> 
like image 542
Roman Bats Avatar asked Apr 24 '12 14:04

Roman Bats


People also ask

How do I add file path to Web config?

Answers. later you can access the file path using: string filePath = ConfigurationManager. AppSettings["Path"].

What does .config file do?

A configuration file, often shortened to config file, defines the parameters, options, settings and preferences applied to operating systems (OSes), infrastructure devices and applications in an IT context. Software and hardware devices can be profoundly complex, supporting myriad options and parameters.

What file type is Web config?

web. config file is an XML-based configuration file used in ASP. NET-based applications to manage various settings that are concerned with the configuration of our website. In this way, we can separate our application logic from configuration logic.


1 Answers

It is not entirely clear what you want to do, but all configuration sections can be stored in a separate files and be referenced by the main .config file using the configSource property.

See this blog post for details.

like image 89
Oded Avatar answered Sep 22 '22 13:09

Oded