.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> ASP.NET >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Random Password Generator

Posted By:Gowthammanju       Posted Date: June 04, 2011    Points: 200    Category: ASP.NET    URL: http://www.dotnetspark.com  

This creates the automatic passwords which includes text,numbers and syambol
 

Hi,

   This projects explain about the generation of random password genarator

It said to posses various steps such as,

1)Creation of lable in aspx page

2)copy and paste the below code

3)run it find solution



protected void Page_Load(object sender, EventArgs e)
    {
        Label1.Text = RandomString(8);
    }
    
    private string RandomString(int StrLength)
    {
        string CharsList = "abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        char[] chars = CharsList.ToCharArray();

        RNGCryptoServiceProvider cryptoGen = new RNGCryptoServiceProvider();
        byte[] ByteData = new byte[StrLength];
        cryptoGen.GetBytes(ByteData);

        StringBuilder ResultStr = new StringBuilder();
        foreach (byte byt in ByteData)
        {
            ResultStr.Append(chars[byt % chars.Length]);
        }
        return ResultStr.ToString();
    }

 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend