473,407 Members | 2,546 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,407 software developers and data experts.

C# will not write to registry

I have a program that encrypts a datetime objects "to
long datetime string" string to and encrypted sequence.
The problem is this: if I use the following source code
it works (key is declared earlier and works fine):

string valueName= "Date Installed";
key.SetValue(valueName, "²ã95ì.*úÞx e¸<¡uO2s¯EÔ");

The problem is this code doesn't:

string valueName = "Date Installed";
object s1 = "²ã95ì.*úÞx e¸<¡uO2s¯EÔ";
//(I have tried string instead of object)

key.SetValue(valueName, Convert.ToString(s1));

When I check the registry in this case, only "²ã95ì.*úÞx"
was written. Please help if you can! This is driving me
crazy!
Nov 22 '05 #1
2 1469
Dean Bortell <bo******@cdfainc.com> wrote:
I have a program that encrypts a datetime objects "to
long datetime string" string to and encrypted sequence.
The problem is this: if I use the following source code
it works (key is declared earlier and works fine):

string valueName= "Date Installed";
key.SetValue(valueName, "²ã95ì.*úÞx e¸<¡uO2s¯EÔ");

The problem is this code doesn't:

string valueName = "Date Installed";
object s1 = "²ã95ì.*úÞx e¸<¡uO2s¯EÔ";
//(I have tried string instead of object)

key.SetValue(valueName, Convert.ToString(s1));

When I check the registry in this case, only "²ã95ì.*úÞx"
was written. Please help if you can! This is driving me
crazy!


I suggest that instead of using a string of that form, that you encrypt
to a byte array and then use Convert.ToBase64String - that's much more
likely to be reliable.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 22 '05 #2
Dean Bortell <bo******@cdfainc.com> wrote:
I have a program that encrypts a datetime objects "to
long datetime string" string to and encrypted sequence.
The problem is this: if I use the following source code
it works (key is declared earlier and works fine):

string valueName= "Date Installed";
key.SetValue(valueName, "²ã95ì.*úÞx e¸<¡uO2s¯EÔ");

The problem is this code doesn't:

string valueName = "Date Installed";
object s1 = "²ã95ì.*úÞx e¸<¡uO2s¯EÔ";
//(I have tried string instead of object)

key.SetValue(valueName, Convert.ToString(s1));

When I check the registry in this case, only "²ã95ì.*úÞx"
was written. Please help if you can! This is driving me
crazy!


I suggest that instead of using a string of that form, that you encrypt
to a byte array and then use Convert.ToBase64String - that's much more
likely to be reliable.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 22 '05 #3

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

Similar topics

1
by: Dean Bortell | last post by:
I have a program that encrypts a datetime objects "to long datetime string" string to and encrypted sequence. The problem is this: if I use the following source code it works (key is declared...
3
by: caldera | last post by:
Hi, I write a windows service. In that service I create a new subkey for registry. But service install is call CreateSubKey() the program throw an exception to the event log said that Cannot write...
3
by: Nikolay Petrov | last post by:
Why I always get 'Requested registry access is not allowed' when i try to Read/Write to Windows Registry from ASP service. I use ASP NET account? Also granted full permissions to required Registry...
20
by: Newbie Coder | last post by:
MFC Application VC++.NET 2003 I have a certain registry key (HKCU\Software\MyKey) that contains between 30 & 64 string values I need to write a '*' to all those 30 - 64 string values under...
8
by: Kniffel | last post by:
hi everyone I programm an ISAPI extension with embedded Visual C++ for a Windows CE device. I try to write the network settings to the registry. I am able to write the IpAdress to the registry,...
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: 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,...
0
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...

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.