Posts

Showing posts from October, 2022

Random Password Generator in C#.NET

Image
This blog is going to illustrate the Random Password Generator in the .NET Framework. The GeneratePassword method is used to generate a random password and is most commonly used for reset password and new or temporary password. It is a very easy to use method. GeneratePassword() method will generate the password with specific length. The following is a syntax for GeneratePassword method public   static   string   GeneratePassword  ( int   length ,  int   numberOfNonAlphanumericCharacters ); Length (int): The password length numberOfNonAlphanumericCharacters (int): Minimum no. of alphanumeric characters. The following is a code snippet to generate a random password. Here length and nonAlphaNumeric values are passed to Membership.GeneratePassword() method. And the result has been assigned to the password textbox. using   System . Web . Security ;   private   void   GeneratePasswordButton_Click ( object   sender ,  EventArgs   e ) {      passwordTextBox . Text  =