473,386 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Password authentication

HI,

Why is this password authentication not working as I am sending? I am trying
to change the password and yet it is not working. What am I doing wrong?

TIA

Roy

using System;

public class Authenticator

{

private string Password;

public bool IsPasswordCorrect(string password)

{

return (password == Password) ? true : false;

}

public bool ChangePassword(string oldPassword, string newPassword)

{

if (oldPassword == Password)

{

Password = newPassword;

Console.WriteLine("Inside EQUAL {0} ",Password);

Console.ReadLine();

return true;

}

else

{

Console.WriteLine("Inside NOT EQUAL {0} ",Password);

Console.ReadLine();

return false;

}
}

}

class clsMain

{

static void Main()

{

Authenticator Simon = new Authenticator();

bool Done;

Done= Simon.ChangePassword("", "MyNewPassword");

if (Done==true)

Console.WriteLine("password for Simon changed");

else

Console.WriteLine("Failed to change password for Simon");
if (Simon.IsPasswordCorrect("what pw"))

Console.WriteLine("Verified ");

else

Console.WriteLine("NOT Verified ");

Console.ReadLine();

}

}
Nov 17 '05 #1
3 2003
SP

"Roy Gourgi" <ro***@videotron.ca> wrote in message
news:nO*******************@wagner.videotron.net...
HI,

Why is this password authentication not working as I am sending? I am
trying to change the password and yet it is not working. What am I doing
wrong?

private string Password;
public bool ChangePassword(string oldPassword, string newPassword)
{
if (oldPassword == Password)
{

Authenticator Simon = new Authenticator();

bool Done;

Done= Simon.ChangePassword("", "MyNewPassword");


I assume Done is returning false. That is because you are comparing an empty
length string to a null string, which will return false;

SP
Nov 17 '05 #2
Hi,
Yes that is right it is returning false. So how would I do it. I took this
example straight out of a book. So much for that. :)

Roy
"SP" <ec***********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...

"Roy Gourgi" <ro***@videotron.ca> wrote in message
news:nO*******************@wagner.videotron.net...
HI,

Why is this password authentication not working as I am sending? I am
trying to change the password and yet it is not working. What am I doing
wrong?

private string Password;
public bool ChangePassword(string oldPassword, string newPassword)
{
if (oldPassword == Password)
{

Authenticator Simon = new Authenticator();

bool Done;

Done= Simon.ChangePassword("", "MyNewPassword");


I assume Done is returning false. That is because you are comparing an
empty length string to a null string, which will return false;

SP

Nov 17 '05 #3
SP
"Roy Gourgi" <ro***@videotron.ca> wrote in message
news:2C*******************@wagner.videotron.net...
Hi,
Yes that is right it is returning false. So how would I do it. I took this
example straight out of a book. So much for that. :)

Roy
you can declare Password as private string Password = "";

SP


"SP" <ec***********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...

"Roy Gourgi" <ro***@videotron.ca> wrote in message
news:nO*******************@wagner.videotron.net...
HI,

Why is this password authentication not working as I am sending? I am
trying to change the password and yet it is not working. What am I doing
wrong?

private string Password;
public bool ChangePassword(string oldPassword, string newPassword)
{
if (oldPassword == Password)
{

Authenticator Simon = new Authenticator();

bool Done;

Done= Simon.ChangePassword("", "MyNewPassword");


I assume Done is returning false. That is because you are comparing an
empty length string to a null string, which will return false;

SP


Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Tim Daneliuk | last post by:
OK, I've Googled for this and cannot seem to quite find what I need. So, I turn to the Gentle Geniuses here for help. Here is what I need to do from within a script: Given a username and a...
14
by: John Davis | last post by:
Anyone knows how to create the username/password authorization dialog in ASP? Thanks, John
7
by: jrefactors | last post by:
I want to ask how password is stored and how to check the authentication? I have heard password is never encrypted and decrypted, but it is hashed. For example, consider a simple email logon...
3
by: Henry | last post by:
Hi, my asp.net application is accessing a mssql on another server. This works fine when I use this in my web.config file: <add key="dbkey"...
8
by: Noel Volin | last post by:
Anyone who can help here is much appreciated. I am trying to programmatically log onto a website. I am using the code provided in VS for the AuthenticationManager Class example (...
2
by: Dmitri Priimak | last post by:
Hi All. There is one thing which somewhat annoys me, which is that psql always prompts me for a password. That makes it difficult for use in Makefile where I want to say 'make build_db', which...
2
by: J | last post by:
Hello. I apologize if this isn't the appropriate group for this question but I was wondering if it's possible to allow regular windows domain users to change their passwords through an .asp page? ...
5
by: Afshar | last post by:
Hi everybody there, I have a special Login page that wants users to enter 3 passwords rather than a single password. But can't do it with Login control. I tried following scenarios: 1. Put an...
9
by: webrod | last post by:
Hi all, how can I check a user/password in a LDAP ? I don't want to connect with this user, I would like to connect to LDAP with a ADMIN_LOG/ADMIN_PWD, then do a query to find the user and...
3
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.