app-config

ConnectionStrings in app.config. What about security?

纵然是瞬间 提交于 2019-12-05 04:21:43
问题 Is it really a Good Thing to put connection strings with passwords in the app.config file? It seems to me that the app.config is not encrypted in any way and the password information can be easily read. I have an app which accesses a database for which the intended end-user have no authentication. A group user/password is used. The application only starts if the current windows user is in an Active Directory group. So, once in the app, the user is allowed to connect to the DB using the group

.NET Configuration Section Designer - Where is my collection?

你离开我真会死。 提交于 2019-12-05 04:04:37
问题 I am using the Configuration Section Designer for .NET to build a simple ConfigurationElementCollection . It appears that everything builds just fine and the code is automatically generated since the sub-elements are visible with Intellisense. Unfortunately, even though I have added elements to the collection in the configuration section, they do not exist at run-time; it shows the collection's Length property to be 0 - i.e. the collection is empty even though, as you can see in my example

How to read AppSettings from app.config in WinForms

a 夏天 提交于 2019-12-05 03:42:32
I usually use a text file as a config. But this time I would like to utilize app.config to associate a file name (key) with a name (value) and make the names available in combo box <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="Scenario1.doc" value="Hybrid1"/> <add key="Scenario2.doc" value="Hybrid2"/> <add key="Scenario3.doc" value="Hybrid3"/> </appSettings> </configuration> will this work? how to retrieve the data ? Gromer Straight from the docs : using using System.Configuration; // Get the AppSettings section. // This function uses the AppSettings property

Configuration System Failed To Initialize

爱⌒轻易说出口 提交于 2019-12-05 00:54:32
In my application when I try to get the connection string by using this code : System.Configuration.ConfigurationManager.ConnectionStrings["ConStr"].ConnectionString; It throws an exception that "Configuration System Failed To Initialize". Where is the format of app.config wrong ? <?xml version="1.0"?> <configuration> <connectionStrings> <add name="ConStr" connectionString="Integrated Security=false;Persist Security Info=False;User ID=funny;password=veryfunny;Initial Catalog=vegimanager;Data Source=.\sqlexpress;"/> </connectionStrings> <configSections> <sectionGroup name="userSettings" type=

Enabling log levels in log4net

拟墨画扇 提交于 2019-12-05 00:45:21
I'm writing a simple test project to experiment with log4net and I've hit a wall right off the bat. No matter what I do in my config file, the my logger is initialized with all "IsXXXXEnabled" flags set to false. Here is my very simple app.config: <log4netgroup> <log4net xsi:noNamespaceSchemaLocation="http://csharptest.net/downloads/schema/log4net.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <appender name="EventLogAppender" type="log4net.Appender.EventLogAppender"> <param name="LogName" value="Application" /> <param name="ApplicationName" value="HelloProgram" /> <threshold

How to make ConfigurationManager read a config file other than app.config?

夙愿已清 提交于 2019-12-04 23:54:01
I need to parse a config file that is situated in another project. I know that ConfigurationManager reads the app.config file by default, but how to make it read that particular config file? // Create a filemap refering the config file. ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap(); fileMap.ExeConfigFilename = configFilePath; // Retrieve the config file. Configuration configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None); Or like this: var fileMap = new ConfigurationFileMap(configFilePath); Configuration config =

How can a NuGet package include transformations for both app.config and web.config?

北城余情 提交于 2019-12-04 23:21:35
I'm trying to create a nuget package which will both add a DLL and configure it inside of the proper configuration file. The package can be used in either a console/form application or a web application, so I want to update the appropriate configuration file, either app.config or web.config. My files section in the .nuspec file contains the following inside of the section. <file src="config.transform" target="content\app.config.transform"/> <file src="config.transform" target="content\web.config.transform"/> The .nupkg file does contain both of the transforms inside of the content folder. When

Combining multiple config files in Visual Studio

放肆的年华 提交于 2019-12-04 19:25:36
问题 I have a solution in Visual Studio 2008 which contains multiple C# projects. Each project has it's own config file (App.config and Settings.settings). This makes sense architecturally as each module is autonomous and is used in a number of different solutions. My problem is that when I compile the solution only the config file for the startup project (or project containing the executable) is included. For other modules the config settings are compiled into the DLL. So my question is, is there

Encrypting config files for deployment

末鹿安然 提交于 2019-12-04 19:16:14
I have a windows service that reads from app.config. I want some settings to be encrypted, however, I don't want to use the ProtectedConfigurationProvider classes provided in .NET because they encrypt files based on the machine they are running on using DPAPI. What I wanted was a way for our administrator to deploy the config file already encrypted to many machines and have each machine decrypt them when needed. I don't want to hardcode a password into the assembly either so I'm not sure how I can go about this. reduce the problem to its simplest form: you have a program that will be given an

SmtpClient and app.config system.net configuration

℡╲_俬逩灬. 提交于 2019-12-04 18:15:30
问题 I'm having an issue with a .NET 3.5 library I'm developing to send emails. I put the system.net configuration into app.config : <system.net> <mailSettings> <smtp from="mail@domain.com"> <network host="myserver.com" port="25" defaultCredentials="true" /> </smtp> </mailSettings> </system.net> And I instantiate the SmtpClient without params: SmtpClient client = new SmtpClient(); But the configuration is not read (I'm trying to test the library with NUnit) and I get a System