Hi C Sharpers,
I'm developing a WinForm app that needs to determine the current user
of the system (Win2000, WinXP) and send that profile's information to
the server. The best way so far is to read into the system registry and
retrieve it. How can I securely do this in C# In my application,
there is also supposed to be an added feature that allow users to
change their username and password. I understand this has something to
do with writing to registry but I'm a newbie in this, pls help me guys.
any idea, sample codes (c# or VB.net) are much appreciated.
Regards.

Determine current WinXP user profile by reading the registry with C#
Drak Swordsman
Regards.
diptivs
You don't need to use the registry for any of that. You can retrieve the current user name with System.Environment.UserName.
Hal T
For security reasons you can't retrieve a users password.
If you want to store data associated with the user, the Registry (under HKCU) is one of many options. You can also store it in a file in the user profile, or in AD. It all depends on what kind of data it is and how you want to access it.
thomasn
hi,
its better to make a variable in your class that holds the user name for example this variable retrieve the user name from t he register when the class intialized, and store the value in the register during class closing and the user can change his user name during your application is running something like session
if you want to store data in registery you can use when you closing your form
Application.UserAppDataRegistry.SetValue("OldUserName", _UserName);if you want to read it
_UserName= (
String)Application.UserAppDataRegistry.GetValue("OldUserName");but wrape reading trial with try catch statement becuase if the user is a new user he will not has any value registered and that will through exception
hope this helps