473,569 Members | 2,402 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Writing and reading to application settings

1 New Member
Hi,
I`m writing an application that can be updated from remote server. Application config file is updating too (adding new sections etc...)
When application is updating i make a copy of old config file and then overwrite it. Values in new config file then restored from old file:
Expand|Select|Wrap|Line Numbers
  1. setNew.Value.ValueXml.InnerXml = setOld.Value.ValueXml.InnerXml;
where setNew and setOld are instances of SettingElement class

after this new file is written:
Expand|Select|Wrap|Line Numbers
  1. configNew.Save(ConfigurationSaveMode.Minimal, true);
where configNew is an instance of Configuration class

if old value (for example Password) is an empty string it write to xml file like this

<setting name="Password" serializeAs="St ring">
<value>
</value>
this value will be read as carriage return symbol and some spaces.
When I`m changing it manually to this:
<setting name="Password" serializeAs="St ring">
<value></value>
or this:
<setting name="Password" serializeAs="St ring">
<value/>
value will be read as empty string(which is needed)

How can I force xml serialization mechanizm to use these variants of notation(for empty values)?

Pls help.
Jul 6 '07 #1
0 1073

Sign in to post your reply or Sign up for a free account.

Similar topics

6
23572
by: Sebastian Kemi | last post by:
How should a write a class to a file? Would this example work: object *myobject = 0; tfile.write(reinterpret_cast<char *>(myobject), sizeof(*object)); / sebek
6
577
by: msnews.microsoft.com | last post by:
Hi all, I was trying to find an easy way to write in the standard configuration (like app.config) xml-based files. I found classes that can be used to read this information (in System.Configuration) like the ConfigurationSettings.AppSettings property, but I was not able to find anything to write app settings in these files. Isn't this kind...
2
2736
by: Tony Jones | last post by:
Is it possible for me to create a class library DLL and have it read it's configuration settings from the web.config of the ASP.NET application referencing it? IE - if I call ConfigurationSettings.GetConfig("somesection") in one of the base class dll methods, will it/can it return the settings from the web.config? For example, I would...
4
1885
by: William Sullivan | last post by:
I have an application that pulls images from a physical drive directory, creates a PDF of the image, caches the image, and returns a link to the client (using ajax, but that's not the problem). I'm faced with having to do this without knowing where this PDF cache location is. It may be on the local drive, or it may be on a network share. ...
19
2517
by: Noozer | last post by:
I need to keep my application settings in a file that users can copy/backup/etc. Before I start using the old INI file standard, is there any easy way to use XML files to hold application settings? What is the standard method of saving user settings for VB.Net apps?
3
3031
by: Sřren M. Olesen | last post by:
Hi I've created a Class library (myClasses.dll), and added a settings.settings to it using designer. However when I use this class library, it doesn't seem to read the settings myClasses.dll.config file, instead I just get then initial values I used when creating the settings.settings section. What do I have to do to get the...
6
3390
by: JeffDotNet | last post by:
Writing to a registered source in the Application event log I have an asp.net framework 2.0 app that I created on a winxp machine and now I am deploying it to IIS6 on a win server2003 machine. This application has to write to the application event log. After deployment of the application I have verified that my source “MySource”...
1
7474
by: M Irfan | last post by:
Hello all, Recently I have started working in .NET 2.0. I am developing a web service application that references a DLL component written in C# 2.0. The component has its own config file which contains settings related to business logic coded in that component. I can reference and load the component but unable to read load the custom config...
0
8157
by: Lucky | last post by:
Hi guys, I've got a problem under reading settlings from App.config file. I've used System.Configuration to reach to the "User Settings" and "Application Settings" sections. the problem is now I'm not able read the property defined under this section. those are like this User Settings -Testing Application Settings -Test
0
7703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7679
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6287
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5223
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3657
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1228
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.