Get Random Password Using GUID : Password « Security « C# / C Sharp






Get Random Password Using GUID

        

using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Caching;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;

public sealed class Util
{


    public static string GetRandomPasswordUsingGUID(int length)
    {
        string guidResult = System.Guid.NewGuid().ToString();
        guidResult = guidResult.Replace("-", string.Empty);
        if (length <= 0 || length > guidResult.Length)
            throw new ArgumentException("Length must be between 1 and " + guidResult.Length);
        return guidResult.Substring(0, length);
    }
}

   
    
    
    
    
    
    
    
  








Related examples in the same category

1.Directory Services Change PasswordDirectory Services Change Password
2.Utility class for encrypting passwords and comparing two encrypted passwords.
3.Password Encrypter
4.Send Password Email