473,468 Members | 1,352 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Replace registry data with app.config


Is there an MSDN article that I can't find on replacing the registry calls
(Registrykey.GetValue, Registrykey.SetValue) with the calls to get and put
the same data in app.config?

Thanks
Tom
Jul 20 '06 #1
2 2236
Tom,

No, there isn't, since there isn't a one-to-one mapping of how the data
is stored in the registry versus the way it is stored in the app.config
file.

You will have to create your own configuration section handler most
likely which will read the xml in the config file the way that you need to.

It's not a simple search and replace operation. I would recommend
reading some articles on configuration files and the System.Configuration
namespace.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<ne***************@charter.netwrote in message
news:Ub*************@fe03.lga...
>
Is there an MSDN article that I can't find on replacing the registry calls
(Registrykey.GetValue, Registrykey.SetValue) with the calls to get and put
the same data in app.config?

Thanks
Tom

Jul 20 '06 #2
Tom,

If you check my blog:

spaces.msn.com/sholliday/
2/8/2006 entry

There is a "smtp server settings" project.

Of course, smtp server settings isn't what you're looking for, ~but it has
the code for writing
configuration section handler as Nicholas talks about.

Mine looks like this:

and I use it to create
SmtpServer objects (with some properties)
and put those into a
SmtpServerCollection object.

its basically an xml file to object mapping type system.


<?xml version="1.0" encoding="utf-8" ?>

<configuration>

<configSections>

<section name="EmailSettingsSectionName"
type="GranadaCoder.Email.Settings.EmailSmtpSetting sHandler,GranadaCoder.Emai
l.Settings" />

</configSections>

<EmailSettingsSectionName defaultEmailFrom="do********@donotreply.com"
portNumber="25">

<!--You need to add a reference to
GranadaCoder.Email.Settings.EmailSmtpSettingsHandl er.dll since this dll
lives outside this (Presentation) assembly-->

<!--Comments can go here-->

<!--SSL example. Google(gmail)Mail is a good (free) example of this.
Naturally, you need to provide a legitimate username and password-->

<!--Note, with the 2.0 Framework, my tests show that gmail likes port 587-->

<smtpServer enabled="true" smtpServerName="smtp.gmail.com"
defaultEmailFrom="do********@gmail.com" portNumber="465"
authenicationMode="SSL" smtpUserName="my************@gmail.com"
smtpUserPassword="mygmailpassword" executeOrder="3"/>

<!--Basic authentication. Passing in a username (and sometimes a password)
are used here.-->

<smtpServer enabled="true" smtpServerName="smtp-server.nc.rr.com"
defaultEmailFrom="do********@rr.com" portNumber="25"
authenicationMode="basic" smtpUserName="my*****@rr.com" executeOrder="2"/>

<!--None authentication. Nothing but the smtp-server name is provided-->

<smtpServer enabled="false" smtpServerName="smtp.noauthenticationneeded.com"
authenicationMode="none" executeOrder="1"/>

</EmailSettingsSectionName>

</configuration>


<ne***************@charter.netwrote in message
news:Ub*************@fe03.lga...
>
Is there an MSDN article that I can't find on replacing the registry calls
(Registrykey.GetValue, Registrykey.SetValue) with the calls to get and put
the same data in app.config?

Thanks
Tom

Jul 20 '06 #3

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

Similar topics

2
by: Bob Olsson | last post by:
Hello all! I´m going to develop a windows smartclient and can´t find the information I need. Where do I store user-settings like paths, background colour and so on. I´ve read an article about...
8
by: Bob Kirkwood | last post by:
I believe the intent in .NET is that we store application setup information in an XML file now instead of the Registry or INI files. Is this correct? Are there any tools, sample apps, or...
1
by: Martin Harran | last post by:
I understand that MS are encouraging developers using the NET platform to move away from storing application related data in the registry and to store it in data files instead. Is there a "best...
2
by: Tim Blizard | last post by:
I know this topic has been discussed before but I couldn't find any thread more recent than about 18 months and was interested in what conclusions people had come to recently. Invariably 3...
3
by: Danny | last post by:
Hi I just have a quick question. One of our Windows based application uses the registry for configuration type options and some other things. I want to modify our application to move to use a...
10
by: Clint | last post by:
Hey all - I'm having a really confusing problem concerning a web service. Right now, I have an application that needs to call a web service that does nothing but return "true" (this will...
3
by: mark.jerrom | last post by:
I'm fairly new to this Web Service game so please feel free to suggest something different if it looks like i'm completely off track! I'm trying to write an application that runs on a Pocket PC...
9
by: nbs.tag | last post by:
hey guys heres my question. I was told by a little birdie that .net 2.0 has the ability to read a connection string directly from a registry key. so in the registry key a string value of say :...
6
by: JOSII | last post by:
Getting a string of boolean value into and out of the registry is no problem. Here's the problem: Although you can place an object into the registry and retreive it, I need to place an ArrayList...
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
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
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...
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,...
1
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.