Hi
I have created a login page which has user name n password. After entering values it authenticate from SQL Server and if it is correct, it forwards to designated page otherwise shows invalid login message. i have 5000 users in my system, so i opted this way. Now i want ot create a button on login page which shows change password. I want to replace my old password field value with new password field. I don't want to create another column and don't want to use asp web administration tool
any help will be appreciated
thank you
7 5369
Have you looked at the at the login controls provided in ASP.Net 2.0? They are simple to use. A control that may be useful to you could be the Password Recovery Web Control.
Christopher Pond Innovative Website Development
Hi,
thank You for response, but i do not want to use SQLmembershipprovider. I want to create simple change password tool which asks for current password and new password and based on that it should replace old password with new password in database. I have only 3 columns in database - user, password and email.
thank You
I would add a form with 3 text boxes as you'll see in many web sites.,
Enter Old Password ()
Enter New Password()
Confirm New Password()
Then in SQL(psedo Code) Update Table set Password= NewPassword where Password = OldPassword And Email = Email.
Does that help?
thank you, it did work out but when i am trying to put validators on textboxes, it doesn't work
thank you, it did work out but when i am trying to put validators on textboxes, it doesn't work
What isn't working on the validators?
Its working now, mistakenly I used Comparevalidator on both textboxes(New Password and Confirm New Password), it should be on one only. - <table style="text-align:right; width:auto;">
-
<tr><asp:ValidationSummary ID="ValSumm" runat="server" /><br /><asp:CompareValidator ID="ComValCNP" runat="server" ControlToCompare="NewPassword" ControlToValidate="ConfirmNewPassword">Password Should Match</asp:CompareValidator></tr><tr>
-
<td>
-
<asp:Label ID="Label1" runat="server" Text="Current Password"></asp:Label></td>
-
<td>
-
<asp:TextBox ID="CurrentPassword" runat="server" TextMode="Password" />
-
<asp:RequiredFieldValidator ID="ReqFVCP" runat="server" ControlToValidate="CurrentPassword"
-
ErrorMessage="Please Enter Current Password">*</asp:RequiredFieldValidator></td>
-
</tr>
-
<tr>
-
<td>
-
<asp:Label ID="Label2" runat="server" Text="New Password"></asp:Label></td>
-
<td>
-
<asp:TextBox ID="NewPassword" runat="server" TextMode="Password"></asp:TextBox> <asp:RequiredFieldValidator ID="ReqFVNP" runat="server" ErrorMessage="Please Enter New Password" ControlToValidate="NewPassword">*</asp:RequiredFieldValidator>
-
</td>
-
</tr>
-
<tr>
-
<td>
-
<asp:Label ID="Label3" runat="server" Text="Confirm New Password"></asp:Label></td>
-
<td>
-
<asp:TextBox ID="ConfirmNewPassword" runat="server" TextMode="Password"></asp:TextBox><asp:RequiredFieldValidator ID="ReqFVCNP" runat="server" ErrorMessage="Please Confirm New Password" ControlToValidate="ConfirmNewPassword">*</asp:RequiredFieldValidator>
-
-
</td>
-
</tr>
-
<tr>
-
<td>
-
<asp:Button ID="Button1" runat="server" Text="Save" OnClick="Button1_Click" /></td>
-
<td> <asp:Button ID="refresh" runat="server" Text="Refresh" OnClick="refresh_Click" /></td>
-
</tr>
-
</table>
-
code behind - protected void Button1_Click(object sender, EventArgs e)
-
{
-
-
string oldPassword = CurrentPassword.Text;
-
string newPassword = NewPassword.Text;
-
bool result = ChangeUserPassword(oldPassword, newPassword);
-
}
-
private bool ChangeUserPassword(string oldPassword, string newPassword)
-
{
-
-
string query = "ChangePassword";
-
//string query = @"Update Users set Password = @NewPassword where Password = @OldPassword";
-
string connectionString = (string)ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
-
SqlConnection myConnection = new SqlConnection(connectionString);
-
SqlCommand myCommand = new SqlCommand(query, myConnection);
-
myCommand.CommandType = CommandType.StoredProcedure;
-
myCommand.Parameters.AddWithValue("@NewPassword", newPassword);
-
myCommand.Parameters.AddWithValue("@OldPassword", oldPassword);
-
-
myConnection.Open();
-
string userId = (string)myCommand.ExecuteScalar();
-
-
//string userId = (string) myCommand.ExecuteScalar();
-
myConnection.Close();
-
-
if (userId != null && userId.Length > 0)
-
return true;
-
else return false;
-
}
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: william |
last post by:
Hi,
I have a dropdownlist control and a few textbox on my web form. How can I
update those textbox content when user select item from dropdownlist control?
I really want to do this on client...
|
by: Pavan |
last post by:
Hi All,
I am using Password Recovery control in order to reset my hashed passwords
in ASP .Net 2.0 Beta 2.
The system generated password is too difficult to remember, so i am giving
Change...
|
by: a_hartmann_andersen |
last post by:
Hi Guys
Here is the problem: Im bored changing the local administrator password
for a set of servers in a domain.
So I though that I would write myself a little tool in C# to do that.
I found...
|
by: John |
last post by:
Hi
I am using the Change Password control which works fine and changes the
password. I have two problems;
1. After password has been changed, pressing continue goes no where. How can
I tell...
|
by: Xnet |
last post by:
I need to change password of a local user of a W2003, without Active
Directory.
I need to do it from an application created with VB2005.
Thanks!
|
by: Ron |
last post by:
Hi,
I need to turn off my menu control when a user is in the process of changing
there password.
I know this can be done because the Login control automatically prevents the
rendering of the...
|
by: roshina |
last post by:
Hi
Iam facing a problem in my project, developing a web site for online shopping in ASP on windows XP using IIS server.
All the validations are ok but the new password is not upadated in the data...
|
by: =?Utf-8?B?V2FubmFiZQ==?= |
last post by:
I added a change password control to my application and when I run the page
that has it, I get an error:
Generating user instances in SQL Server is disabled. Use sp_configure 'user
instances...
|
by: =?Utf-8?B?QXhlbCBEYWhtZW4=?= |
last post by:
Hi,
we've got a strange problem here:
We've created an ASP.NET 2.0 web application using Membership.ValidateUser()
to manually authenticate users with our website.
The problem is: If the...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |