change password form in asp net c#

In previous post we have learned how to create simple login form and create registration form in using sql database with c# language.

In this post, we will learn how to create a change password form for already registered user. For change password user first need to register with detail and get username and password. After register user has to login with his username and password. if username and password march then change password  form loaded to user screen and user can change his password by verifying current password.

change password form in c#
change password form in c#

First create a sql table for store user registration detail. we have here created sql table “UserMst” like below:

Here is the sql script for UserMst table:


[Name] [nvarchar](50) NULL,
[SurName] [nvarchar](50) NULL,
[City] [nvarchar](50) NULL,
[Email] [nvarchar](50) NULL,
[Password] [nvarchar](50) NULL,


change password form in c#
change password form in c#

The html source code for change password form design.

The design form layout is:

change password form in c#
change password form in c#

Here, we first check the use current password, if matches then user can make new password or  we can also say change password.

we user required field validator control for all three textboxes and user compare validator for compare new password and confirm password field in change password example.

The c# code for change password button.

In above change password example we use  session[“uname”] in update sql query for change password. When user login in to system with his username and password at that time if credential match then store username or email in session[“uname”].

(Visited 1,608 times, 1 visits today)

5 thoughts to “change password form in asp net c#”

  1. Thank you so much, your this code much help me
    m read to many sites StackOverflow, snippets but your codes simple & easy for understand its work thank you 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha *