public static string CreateRandomNumbersword(int iPasswordLength)
{
// Get the GUID
string sGUID = System.Guid.NewGuid().ToString();
// Remove the hyphens
sGUID = sGUID.Replace(
"-", string.Empty);
// Make sure length is valid
if (iPasswordLength <= 0 || iPasswordLength > sGUID.Length)
throw new ArgumentException("Length must be between 1 and " + sGUID.Length);
// Return the first length bytes
return sGUID.Substring(0, iPasswordLength);
}
{
// Get the GUID
string sGUID = System.Guid.NewGuid().ToString();
// Remove the hyphens
sGUID = sGUID.Replace(
"-", string.Empty);
// Make sure length is valid
if (iPasswordLength <= 0 || iPasswordLength > sGUID.Length)
throw new ArgumentException("Length must be between 1 and " + sGUID.Length);
// Return the first length bytes
return sGUID.Substring(0, iPasswordLength);
}
No comments:
Post a Comment