Password Generator

November 21, 2009 at 7:49 am Leave a comment

protected void btnGenerate_Click(object sender, EventArgs e)
{
string allowedChars = “”;
allowedChars = “a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,”;
allowedChars += “A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,”;
allowedChars += “1,2,3,4,5,6,7,8,9,0″;

char[] sep = { ‘,’ };
string[] arr = allowedChars.Split(sep);
string passwordString = “”;
string temp = “”;

Random rand = new Random();
for (int i = 0; i < 6; i++)
{
temp = arr[rand.Next(0, arr.Length)];
passwordString += temp;
}
txtPassword.Text = passwordString;
}

Advertisement

Entry filed under: asp.net, C#. Tags: , .

Email Trace – Email Tracking Getting folder name from drive and Getting file name from folder in C#

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

November 2009
M T W T F S S
« Oct   Dec »
 1
2345678
9101112131415
16171819202122
23242526272829
30  

Follow

Get every new post delivered to your Inbox.