I have an excel C# addin that needs a user authentication form. The username and password would be used for the user to use the UDF formulae in the addin.
Can someone help me with how to go about it with the help of a sample example code?
Thanks
I have an excel C# addin that needs a user authentication form. The username and password would be used for the user to use the UDF formulae in the addin.
Can someone help me with how to go about it with the help of a sample example code?
Thanks
Create a regular Windows form using Visual Studio.
Create an instance of the form and display it using
form.ShowDialog();
Here's one tip:
To store passwords store a hash of the password and only store that. When user logs in, compare hash with hash of password user typed, if they match, that's the user.
You can use MD5 Hash.
As follows:
public static string MD5(string originalPassword)
{
Byte[] originalBytes;
Byte[] encodedBytes;
MD5 md5;
//Instantiate MD5CryptoServiceProvider,
//get bytes for original password and compute hash (encoded password)
md5 = new MD5CryptoServiceProvider();
originalBytes = ASCIIEncoding.Default.GetBytes(originalPassword);
encodedBytes = md5.ComputeHash(originalBytes);
//Convert encoded bytes back to a 'readable' string
return BitConverter.ToString(encodedBytes);
}