asp.net using c#.net code for change password method please help me.

Last post 12-21-2009 6:20 AM by himanet. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 09-15-2009 1:56 AM

    • srinu
    • Top 150 Contributor
    • Joined on 09-09-2009
    • Wannabe Slacker
    • Points 98

    asp.net using c#.net code for change password method please help me.

     sir i want to change password in my form so please help me in this issue.asp.net using c#.net

  •  Advertisement

    Featured Advertisement

     
  • 12-08-2009 7:38 AM In reply to

    Re: asp.net using c#.net code for change password method please help me.

    but you can use session in ur login page 

     

    protected

    void imgbtnsubmit_Click(object sender, ImageClickEventArgs e)

    {

     

    if (txtconform.Text == string.Empty && txtnew.Text == string.Empty && txtconform.Text!=txtnew.Text)

    {

    lblerror.Visible =

    true;

    lblerror.ForeColor = System.Drawing.

    Color.RosyBrown;

    lblerror.Text =

    "All fields are Requried";

    }

     

    else

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    {

     

     

    try

    {

     

     

    SqlConnection con = new SqlConnection("Data Source=HOSERVER\\SQLEXPRESS;Initial Catalog=office;User ID=sa;Password=admin;"

    );

     

     

    SqlCommand cmd = new SqlCommand("update usermaster set User_Password=@User_Password where EMP_ID='"+ Session["empid"].ToString() + "'"

    , con);

    con.Open();

    cmd.Parameters.Add(

     

    new SqlParameter("@User_Password", SqlDbType

    .VarChar, 20));

    cmd.Parameters[

     

    "@User_Password"

    ].Value = txtconform.Text;

    cmd.ExecuteNonQuery();

     

    lblerror.Visible =

     

    true

    ;

    lblerror.ForeColor = System.Drawing.

     

    Color

    .Green;

    lblerror.Text =

     

    "Password Changed"

    ;

     

    con.Close();

     

    txtcurrent.Text =

     

    string

    .Empty;

    txtnew.Text =

     

    string

    .Empty;

    txtconform.Text =

     

    string

    .Empty;

    }

     

     

    catch

    {

    lblerror.Visible =

     

    true

    ;

    lblerror.ForeColor = System.Drawing.

     

    Color

    .Cyan;

    lblerror.Text =

     

    "Password not Changed"

    ;

  • 12-08-2009 8:16 AM In reply to

    • Sonu
    • Top 10 Contributor
    • Joined on 05-22-2006
    • Montreal / Canada
    • Slacker
    • Points 12,183
    • MVP

    Re: asp.net using c#.net code for change password method please help me.

    Please please please format your code before posting it into the editor. The above code is not readable at all and therefore it becomes very difficult to read.

    [MVP since 2005] [MCAD]
    Webmaster of DotNetSlackers
    Question or Suggestion?
    Feel free to ask my any .NET question
    Our Posting FAQ
  • 12-21-2009 6:20 AM In reply to

    • himanet
    • Top 150 Contributor
    • Joined on 12-17-2009
    • Hyderabad
    • Wannabe Slacker
    • Points 158

    Re: asp.net using c#.net code for change password method please help me.

    You can use change password contol .Please check the link below .

    http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/login/changepassword.aspx
     

     

    http://himabinduvejella.blogspot.com

    http://himabinduvejella.blogspot.com
    http://syntaxhelp.com/ASP.NET
Page 1 of 1 (4 items)