app-config

How do I retrieve ApplicationSettings from a loaded App.config file?

主宰稳场 提交于 2019-12-29 04:05:46
问题 Is it possible to access the values from the applicationSettings section of a loaded app.config file? I have found an example How do I retrieve appSettings, but i can't find out how to access applicationSettings this way. 回答1: The applicationSettings are readonly during runtime. You can set/modify them either via a text editor in the app.config file directly, but it is recommended to open the project properties in Visual Studio and select the "Settings" tab. It is important to set the right

Encrypting sections and-or settings in an App.config file that will be redistributed

自闭症网瘾萝莉.ら 提交于 2019-12-28 13:57:07
问题 I'm creating a regular windows application that will be distributed to several users on my department. I'll need to include some connectivity passwords on the App.config file, and I obviously don't want end-users to just fire up notepad and look at the passwords. Several articles point on how to encrypt/decrypt configuration sections, but it appears you have to share/ship some keys with the deployable solution. Is there a simpler way, to just cipher some of the settings so that they are not

How to enable configSource attribute for Custom Configuration Section in .NET?

拜拜、爱过 提交于 2019-12-28 02:58:08
问题 following the wealth of information found here how can we get an external .config to work? I've tried the same setup I would use for an external appSettings file, but it is unable to find the file for my custom section. <configSections> ... <section name="CustomSettings" type="Fully.Qualified.TypeName.CustomSettings, AssemblyName" /> </configSections> <!-- this works --> <CustomSettings attrib1="val1" attrib2="val2" .../> however... <!--this does not work--> <CustomSettings configSource=

Can a class library have an App.config file?

本秂侑毒 提交于 2019-12-27 12:19:10
问题 Here is what my solution is looking like at the moment: In the Tutomentor.Branding project, I'd like to save branding information in the App.config file, like names, colors, etc. In the Tutomentor.Data project, the App.config was created when I added an entity .edmx model file. Is this possible? Any recommendations? When deploying, will the output COMBINE these App.config files into a single one? 回答1: No, class libraries can hold setting files, but their values will be defined in the

read,write and update connectionstring in app.config file at run time in C#

﹥>﹥吖頭↗ 提交于 2019-12-25 10:55:08
问题 I have created a form for connection settings, where user can update server name, datatbase and user id and password. I have stored my connection string in app.config file. My problem is, how can I update connection string in app.config file at run time and How can I change the information of the conectionstring through the text box on the form in the first time, the text box will display information of server name, id, password after the first time here my app.config <?xml version="1.0"

How can i tell SubSonic 2 to use a different .config file?

风流意气都作罢 提交于 2019-12-25 08:41:06
问题 I'm using SubSonic 2 from within a project and I'd like to specify a different .config file from the default App.config. How can I tell SubSonic to use a specific config file? 回答1: You can't - SubSonic works from Provider settings that are set for the executing environment. You could, if you wanted, use a connectionStrings.config and put that somewhere else, but SubSonic uses ConfigurationManager to open up the app's config and find it's goodies. 回答2: It appears that you can do this by

adding connection string during installation of vb.net

落爺英雄遲暮 提交于 2019-12-25 07:24:55
问题 this is a follow up for my last question which is on: adding connection string during installation of vb.net project this is the code that I have so far but the "Configuration" in the line: Dim config As Configuration = ConfigurationManager.OpenExeConfiguration(exePath) has a blue line and I can't run the program because of it. I converted the C# code to that one and the blue line appears. what I'm trying to do here is to get the a string that I can use for the connection string which will be

multiple config file in c#

大兔子大兔子 提交于 2019-12-25 06:58:31
问题 I have a solution containing 1 console application and 2 libraries. In the libraries I have two different app.configs for an example my data.config <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="OutputFileFolder" value="c:\\log" /> <add key="OutputIndexFile" value="c:\\log\index.xml" /> </appSettings> </configuration> And in this library class I have in the constructor _indexPath = ConfigurationManager.AppSettings["OutputIndexFile"]; But how should I load the

How do I make App.config values visible for referenced ClassLibraires (Assebmlies)

断了今生、忘了曾经 提交于 2019-12-25 05:17:11
问题 I have a C# Project called Application which is basically considered to represent the top most application layer. All other Layers are treated as ClassLibraries like BUSINESS , DAO and UTIL . Now I want that the application be configurable by using the App.config file. For that purpose I need to make this configuration file visible for the referenced ClassLibraries (Assemblies). For me, the most suitable solution would be that the UTIL assembly has access to the App.config and is able to

.net project app.config binding

谁说我不能喝 提交于 2019-12-25 02:47:08
问题 How is the app.config binding in .Net? Let's say if I have an application project referencing a class library project. The code ConfigurationManager.AppSettings["MySetting"] in the class library project will read the value from app.config from the application project. Is my understanding correct? So how about if we have 2 class library project, let's say A and B while A is referencing B. So will ConfigurationManager.AppSettings["MySetting"] read the value from app.config in project A? Thanks