CSharp examples for Security:Password
Generate Password
using System.Threading.Tasks; using System.Text; using System.Linq; using System.Collections.Generic; using System;/*from w w w . j a va 2 s. c o m*/ public class Main{ public static string GeneratePassword(int length) { const string valid = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; StringBuilder res = new StringBuilder(); Random rnd = new Random(); while (0 < length--) { res.Append(valid[rnd.Next(valid.Length)]); } return res.ToString(); } }