By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,887 Members | 1,214 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,887 IT Pros & Developers. It's quick & easy.

Save configuration and file format

P: n/a
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,

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

KeyValueConfigurationCollection settings1= config.AppSettings.Settings();

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

= tbCadenaConexionFirmasParaServicioIndexado.Text;

//' Modifica el app.config pero pierde los comentarios del appsettings
ServiceModelSectionGroup sectionGroup =

ChannelEndpointElementCollection listaEndpoints =

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

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

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



Sep 25 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.