protected void Button3_Click(object sender, EventArgs e)
    {

        GetRandomPassword();
    }


    public static string GetRandomPassword(int length)
    {

        char[] chars = "$%#@!*abcdefghijklmnopqrstuvwxyz1234567890?;:ABCDEFGHIJKLMNOPQRSTUVWXYZ^&".ToCharArray();
        string password = string.Empty;
        Random random = new Random();

        for (int i = 0; i < length; i++)
        {
            int x = random.Next(1, chars.Length);

            if (!password.Contains(chars.GetValue(x).ToString()))
                password += chars.GetValue(x);
            else
                i--;

        }
        return password;

    }


}

Hi Everyone
This is my code i want generate random password but wt my problems is display the error is No overload for method 'GetRandomPassword' takes '0' arguments How to slove this error plz help me

Hi
I am using asp.net with c#.net my requirments is when i click the button on that time open the browser i search so many sites but i did't get the answer anyone help with me

hello Nithyamaha

as you can see

public static string GetRandomPassword(int length)
{

char[] chars = "$%#@!*abcdefghijklmnopqrstuvwxyz1234567890?;:ABCDEFGHIJKLMNOPQRSTUVWXYZ^&".ToCharArray();
string password = string.Empty;
Random random = new Random();
for (int i = 0; i < length; i++)
{
int x = random.Next(1, chars.Length);
if (!password.Contains(chars.GetValue(x).ToString()))
password += chars.GetValue(x);
else
i--;
}
return password;
}
}

requires one parameter, where in you call the method

GetRandomPassword();

without a parameter.

you should enter an integral value as a parameter to it.

GetRandomPassword(25);

so the password would be 25 characters in length.

Hi Thanks for your reply i got the answer