Introduction: In this article today I am going to explain how we can generate strong random password in asp.net
In the previous article I have explained Send email tomultiple users in asp.net (C#, VB), Send email tomultiple users selected in gridview using asp.net (C#, VB) , Take automaticsnapshot (screenshot) and email it using asp.net (C#, VB) and Create Temporary table dynamically and bind to Gridview in asp.net.
We can generate the random password using ASP.NET Membership provider. ASP.NET Membership has a static method built in to generate password.
HTML markup of Page:
<legend>Generate Random Password</legend>
<tr><td>Password : </td><td>
<asp:TextBox ID="txtpwd" runat="server"></asp:TextBox>
<tr><td></td><td> <asp:Button ID="Button1" runat="server" onclick="Button1_Click"
Text="Generate Password" /></td></tr>
On Button click write the below given code:
protected void Button1_Click(object sender, EventArgs e)
String RandomPassword = System.Web.Security.Membership.GeneratePassword(10, 1);
txtpwd.Text = RandomPassword;
Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
Dim RandomPassword As [String] = System.Web.Security.Membership.GeneratePassword(10, 1)
txtpwd.Text = RandomPassword
Is this article helpful for you?
If yes post your comment to appreciate my work and fell free to contact me. You can like me on Facebook, Google+, Linkedin and Twitter via hit on Follow us Button and also can get update follow by Email.
What do you think about this article?
If you found this article useful, please share and follow on Facebook, Twitter, Google Plus and other social media websites. To get free updates subscribe to newsletter. Please put your thoughts and feedback in comments section.