473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Save configuration and file format

Hi misters,

I have an app.config (UTF-8 format file). I create an application winforms
for changes and save configuration programatically.

When I save changes the format file changes to ANSI :( but I need format
file UTF-8, and too when I open app.config and changed it, Visual Studio
save it like UTF-8.

Any suggestions or comments, please ? I need help about it

Thanks in advance. See code below please

My code is:

string rutaConfig= tbRutaConfigServicioIndexado.Text;
// Map to the application configuration file.
ExeConfigurationFileMap configFile= New ExeConfigurationFileMap();
configFile.ExeConfigFilename = rutaConfig;
Configuration config=
ConfigurationManager.OpenMappedExeConfiguration(co nfigFile,
ConfigurationUserLevel.None);

string[] keys = config.AppSettings.Settings.AllKeys;

KeyValueConfigurationCollection settings1= config.AppSettings.Settings();

settings1("PDF_CREADOR").Value = tbServicioIndexadoPDF_CREADOR.Text;

config.ConnectionStrings.ConnectionStrings["SQLConnection"].ConnectionString
= tbCadenaConexionFirmasParaServicioIndexado.Text;

//' Modifica el app.config pero pierde los comentarios del appsettings
config.Save(ConfigurationSaveMode.Modified);
ServiceModelSectionGroup sectionGroup =
ServiceModelSectionGroup.GetSectionGroup(config);

ChannelEndpointElementCollection listaEndpoints =
sectionGroup.Client.Endpoints;

if (listaEndpoints.Count >= 2)
{
ChannelEndpointElement endpoint = null;
ChannelEndpointElement endpoint2 = null;

// Endpoint Agente Servicio Base
endpoint = BuscarEndpointClientePorNombre(listaEndpoints,
"AgenteServicioBase");
endpoint.Address = new Uri(endpointAgenteServicioBase);

// Endpoint Agente Log
endpoint2 = BuscarEndpointClientePorNombre(listaEndpoints,
"AgenteLog");
endpoint2.Address = new Uri(endpointAgenteLog);

}
config.Save(ConfigurationSaveMode.Modified);

--
http://www.alhambra-eidos.es/web2005/index.html
www.kiquenet.com/churrosoft
http://www.setbb.com/putainformatica...opic.php?p=843
www.trabajobasura.com/solusoft

Sep 25 '08 #1
0 1615

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Maya | last post by:
Hey, there! I'm new to vb.net and it seems I wouldn't be able to solve this without help. I have a pipe delimited file that has to be saved in txt format so it could be accepted by my DTS...
1
by: DraguVaso | last post by:
Hi, I found some examples for storing the FormSettings of a Form in an XML-file, but none of these could match my criteria: What I am looking for is the possibility to save the FormSettings of...
0
by: Andrzej Kaczmarczyk | last post by:
Hello, I am having troubles saving configuration file. I did the folloing: inherited from ConfigurationSection, ConfigurationCollection, ConfigurationElement to define my own element in...
0
by: ssg31415926 | last post by:
I've been trying to save a hashtable in an Application Settings file. I need to save settings for each tabPage on a form. Trouble is, the number of tabPages is determined at runtime, so I can't...
1
by: liuliuliu | last post by:
hi -- sorry if this is trivial -- but how do you make a screenshot of a pygame display? i have a surface which is basically the entire visible screen -- how do you write this surface as an image...
1
by: Shannon Richards | last post by:
Hello All: I have implemented a custom configuration section in my app.config file as follows: <configSections> <section name="AdminUIConfig" type="TestMgr.UIConfigSection,TestMgr"/>...
0
by: =?Utf-8?B?Qy4gSHVnaGVz?= | last post by:
Hello, I have a .net 2.0 application using a 'Settings.settings' configuration file to store application settings. The settings are modified at runtime and stored when the user exits the...
2
by: chike_oji | last post by:
Please can someone help me. I am writing a web application, that allows for the upload of an excel sheet into the database. I have an upload button and a save button. The upload button allows...
0
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgRGVzYXJyb2xsbw==?= | last post by:
Hi, thanks, mister The code string rutaConfig = tbRutaConfigServicioBase.Text; '// Map to the application configuration file. ExeConfigurationFileMap configFile = New...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.