473,395 Members | 1,608 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,395 software developers and data experts.

Persistent settings

Hi

I need to store the path to db in my app. I have used app setting for this.
Unfortunately various clients have different db paths and I have set them up
once on each client location. The problem is that when I send them updates
and they uninstall the old version and reinstall the new version the setting
is reset to my settings. This is because the old configuration file is
deleted and replaced by the new one included in the app. Is there a way to
have a setting that is not overwritten by an application reinstall?

Thanks

Regards


Apr 28 '07 #1
4 1766
On Apr 28, 9:12 am, "John" <J...@nospam.infovis.co.ukwrote:
Hi

I need to store the path to db in my app. I have used app setting for this.
Unfortunately various clients have different db paths and I have set them up
once on each client location. The problem is that when I send them updates
and they uninstall the old version and reinstall the new version the setting
is reset to my settings. This is because the old configuration file is
deleted and replaced by the new one included in the app. Is there a way to
have a setting that is not overwritten by an application reinstall?

Thanks

Regards
I have always used a separate file for things like this - perhaps you
could use an Xml file that is stored in the application's base
directory. If you are worried about the sensitive nature of connection
strings, you could even have your app encrypt/decrypt that file.

Thanks,

Seth Rowe

Apr 28 '07 #2
Many thanks for that. Would be grateful for a link on how to handle xml
files.

Thanks

Regards
"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:11**********************@e65g2000hsc.googlegr oups.com...
On Apr 28, 9:12 am, "John" <J...@nospam.infovis.co.ukwrote:
>Hi

I need to store the path to db in my app. I have used app setting for
this.
Unfortunately various clients have different db paths and I have set them
up
once on each client location. The problem is that when I send them
updates
and they uninstall the old version and reinstall the new version the
setting
is reset to my settings. This is because the old configuration file is
deleted and replaced by the new one included in the app. Is there a way
to
have a setting that is not overwritten by an application reinstall?

Thanks

Regards

I have always used a separate file for things like this - perhaps you
could use an Xml file that is stored in the application's base
directory. If you are worried about the sensitive nature of connection
strings, you could even have your app encrypt/decrypt that file.

Thanks,

Seth Rowe

Apr 28 '07 #3
"John" <Jo**@nospam.infovis.co.ukschrieb:
I need to store the path to db in my app. I have used app setting for
this. Unfortunately various clients have different db paths and I have set
them up once on each client location. The problem is that when I send them
updates and they uninstall the old version and reinstall the new version
the setting is reset to my settings. This is because the old configuration
file is deleted and replaced by the new one included in the app. Is there
a way to have a setting that is not overwritten by an application
reinstall?
Take a look at 'My.Settings' and the "Settings" tab in "My Project" if you
are using VS 2005.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Apr 28 '07 #4
On Apr 28, 12:25 pm, "John" <J...@nospam.infovis.co.ukwrote:
Many thanks for that. Would be grateful for a link on how to handle xml
files.

Thanks

Regards

"rowe_newsgroups" <rowe_em...@yahoo.comwrote in message

news:11**********************@e65g2000hsc.googlegr oups.com...
On Apr 28, 9:12 am, "John" <J...@nospam.infovis.co.ukwrote:
Hi
I need to store the path to db in my app. I have used app setting for
this.
Unfortunately various clients have different db paths and I have set them
up
once on each client location. The problem is that when I send them
updates
and they uninstall the old version and reinstall the new version the
setting
is reset to my settings. This is because the old configuration file is
deleted and replaced by the new one included in the app. Is there a way
to
have a setting that is not overwritten by an application reinstall?
Thanks
Regards
I have always used a separate file for things like this - perhaps you
could use an Xml file that is stored in the application's base
directory. If you are worried about the sensitive nature of connection
strings, you could even have your app encrypt/decrypt that file.
Thanks,
Seth Rowe
Here's a quick console application that briefly demonstrates how to
use an Xml file:

Imports System.Xml

Module Module1

Sub Main()
Console.WriteLine("Saving Settings...")
SaveSettings()
System.Threading.Thread.Sleep(500)
Console.WriteLine(GetSetting("ConnectionString"))
Console.Read()
Dim fileName As String = String.Format("C:\Document and
Settings\{0}\Desktop\MyXmlFile.Xml", Environment.UserName)
If System.IO.File.Exists(fileName) Then
System.IO.File.Delete(fileName)
End If
End Sub

Public Sub SaveSettings()
Dim writer As XmlWriter = XmlWriter.Create(String.Format("C:
\Documents and Settings\{0}\Desktop\MyXmlFile.Xml",
Environment.UserName))
writer.WriteStartElement("Settings")
writer.WriteStartElement("ConnectionString")
writer.WriteString("YourConnString")
writer.WriteEndElement() ' ConnectionString
writer.WriteEndElement() ' Settings
writer.Close()
End Sub

Public Function GetSetting(ByVal nodeName As String) As String
Dim doc As New XmlDocument
doc.Load(String.Format("C:\Documents and Settings\{0}\Desktop
\MyXmlFile.Xml", Environment.UserName))
Dim node As XmlNode = doc.GetElementsByTagName(nodeName)(0)
Return node.InnerText
End Function

End Module

Thanks,

Seth Rowe

Apr 29 '07 #5

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

Similar topics

16
by: Paul Rubin | last post by:
I've had this recurring half-baked desire for long enough that I thought I'd post about it, even though I don't have any concrete proposals and the whole idea is fraught with hazards. Basically...
0
by: obhayes | last post by:
Hi All, Im using classic ASP (3.0) and I have a web farm with 2 webservers (webserver A and webserver B, both windows server 2003). I do not want to store any client specific information on the...
1
by: brad | last post by:
Hi, Im using classic ASP (3.0) and I have a web farm with 2 webservers (webserver A and webserver B, both windows server 2003). I do not want to store any client specific information on the...
5
by: Steve - DND | last post by:
How can I exceed the number of persistent connections allowed on a ServicePoint(which is 2 connections)? I believe this is the cause of the problems with my thread from earlier titled "Unable to...
8
by: Steve | last post by:
Can anyone tell me the preferred method for writing and retrieving persistent information using .Net. Specifically, I am referring to information that you used to see in registry keys or .ini...
2
by: NWx | last post by:
Hi, Is Cache appropriate to store persistent variables used across the application? What I want is to store UserID for currently logged user, SessionID (my own SessionID, which keep track of...
3
by: sanchita | last post by:
Hello everyone, I didn't get any response in "Security" forum hence posting here again. I am having problem with persistent cookies. Even after setting "CreatePersistentCookie" to true in...
1
by: hussain123 | last post by:
Hi, We have an issue wherein we have an persistent store and are caching the url's visited.Now the problem is when the first url is cached then any subsequent request even though to some other url...
0
by: Alex N | last post by:
My question relates to one of the previous ones, http://bytes.com/topic/c-sharp/answers/545389-saving-properties-settings-dll-project If i want to share a single <app>.exe.config file among...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.