Hi, Please see my below code to change password. Here i need to check for old password from database and need to update new password. But when i try to submit by giving wrong old password ,its redirecting me to PasswordSet.asp x whereas it shd give message Invalid Old Password. It shd redirect me only when user gives correct old password and enters new password. please help. - Private Sub btn_submit_ServerClick(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btn_submit.ServerClick
-
-
Dim myConnection, myCommand
-
Dim intUserCount As Integer
-
Dim strSQL As String
-
-
strSQL = "UPDATE EPSusers SET Password='" & Replace(txt_newpassword.Text, "'", "''") & "' " & "WHERE UserName='" & Replace(txt_uid.Text, "'", "''") & "' " _
-
& "AND Password='" & Replace(txt_oldpassword.Text, "'", "''") & "';"
-
-
myConnection = New SqlConnection("Server=(local);Database=testdb;uid=sa;password=courage")
-
-
myCommand = New SqlCommand(strSQL, myConnection)
-
-
myConnection.Open()
-
intUserCount = myCommand.ExecuteScalar()
-
myConnection.Close()
-
-
If txt_oldpassword.Text.Trim = "" Then
-
lblStatus.Text = "Invalid Old Password!"
-
'Exit Sub
-
FormsAuthentication.SetAuthCookie(txt_oldpassword.Text, True)
-
lblInvalid.Text = "Your User Name and Password cannot be located, try again.!!!."
-
'Session("UName") = txt_uid.Text
-
'Response.Redirect("PasswordSet.aspx")
-
Else
-
'lblInvalid.Text = "Your User Name and Password cannot be located, try again.!!!."
-
Response.Redirect("PasswordSet.aspx")
-
End If
-
End Sub
2 1720
Shouldn't you check the password before you try to update?
vanc 211
Recognized Expert New Member
Yeah, that's exactly what your code should do!!! If you input wrong password, except "" password, your piece of code will Redirect you to that page not returns the invalid message, if you want to see that message you should input blank password.
If you want to display invalid password message you have to modify your code.
cheers.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: PerryC |
last post by:
I am able to create a script that will send a report as email attached
rtf file. However, is there a way to make this attached file password
protected? i.e. the recipient needs a password to open up the
attached rtf?
Thanks in advance,
Perry
|
by: Javier Gomez |
last post by:
Is it posible to change by code (in a form) the active .mdw by another
one ?
When I open the DB I have the system.mdw active after some procesess I
need to change to another secure.mdw and make active, but I bought
like it to make it by code inside of a form in button command click.
(I do not want to make it thought tools bars menu.)
Can anybody help ?
|
by: Fabrizio |
last post by:
(Sorry for the crosspost, but I really don't know which is the right
newsgroup!)
Hi all,
I try to change the password to a user that as to change the password at
first logon:
try
{
|
by: John Beard |
last post by:
I downloaded the attached code from MS. It flips on the "User Cannot Change
Password" on a user in AD and works great from a console or
windows app, but when put into an ASP.NET app I get a "The security ID
structure is invalid." error when trying to assign the new security
descriptor. I am running in Windows Authentication mode with IIS set to
Integrated security on an XP box.
Does anyone have a work around for this?
Thanks in...
|
by: Jan |
last post by:
Hi:
I have created a secured database for a client. For various reasons, I
don't want the client to have full persmissions for the database; they
aren't in the admins group. I have instead tried to create a second
group, called "localAdmin," for the admin-type person at the client. I
want this group to be able to do some basic admin-type stuff, including
adding new users and clearing passwords if users forget theirs.
I can't seem to...
| |
by: ckpoll2 |
last post by:
Hello,
I have visual basic code tied to a command button that requires a password before opening a form. When the password is entered, it appears as typed rather than as "******" or something like that. Is there any way to hide what is being typed?
Below is the code that I'm currently using.
Thanks,
Charlie
|
by: W C Hull |
last post by:
We have a request from Auditing to modify the password an a local
workstation administrative account every 90 days. We are developing two
programs - a VB6 GUI program that will allow the administrative support
person to enter a new password into an App and have that encrypted password
saved in a text file. The second part is a VB6 program that only is a
command line program that will open the password text file, read the
encrypted...
|
by: sreekandank |
last post by:
I want to implement POP3 program in java....I have written the code like...
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
import java.io.*;
public class POP3Client {
public static void main(String args) {
|
by: gavy7210 |
last post by:
hello
i am using struts 1.2,Eclipse Platform Version: 3.4.2,mySql 5.0.1,jdk 1.5..
i have a login form(jsp) in which a user logs in,in case he doesnt enter his username and/or password an error is displayed using the <ul> tag and <html:errors> in the jsp. in the from class a vaidate method creates an actionerrors object adds all the errors to it and finally returns it.
the ids are linked in messageresources.properties and appropriate...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |