-----RandomPasswordCrate.cs
public class RandomPasswordCrate
{
public static string GeneratePassword(int PasswordLength)
{
string _allowedChars = "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789_";
Random randNum = new Random();
char[] chars = new char[PasswordLength];
int allowedCharCount = _allowedChars.Length;
for (int i = 0; i < PasswordLength; i++)
{
chars[i] = _allowedChars[(int)((_allowedChars.Length) * randNum.NextDouble())];
}
return new string(chars);
}
}
------In cs Page
protected void Page_Load(object sender, EventArgs e)
{
generatePassword();
}
private void generatePassword()
{
string password = "Your password is: " + RandomPasswordCrate.GeneratePassword(8);
}
Subscribe to:
Post Comments (Atom)
Get all non-clustered indexes
DECLARE cIX CURSOR FOR SELECT OBJECT_NAME(SI.Object_ID), SI.Object_ID, SI.Name, SI.Index_ID FROM Sys.Indexes SI ...
-
We need to jQuery package from http://jqueryui.com/ and jQuery-UI plugin and jQuery styles. Download the packages http://jqueryui.com/a...
-
Create one class named RandomSNKGenerator using System; using System.Collections.Generic; using System.Linq; using System.Web; ...
-
JSON JSON (an acronym for JavaScript Object) is a lightweight text-based open standard designed for human-readable data interchange. It is ...
really this blog is very helpful for growth of knowledge...Thank You for this information...
ReplyDeletedigital image editing
ASP.net this coding for very useful for web and other ...........thnx for sharing such a good post........
ReplyDeletevacation rentals in orlando