473,667 Members | 2,575 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 IsPasswordCorre ct(string password)

{

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

}

public bool ChangePassword( string oldPassword, string newPassword)

{

if (oldPassword == Password)

{

Password = newPassword;

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

Console.ReadLin e();

return true;

}

else

{

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

Console.ReadLin e();

return false;

}
}

}

class clsMain

{

static void Main()

{

Authenticator Simon = new Authenticator() ;

bool Done;

Done= Simon.ChangePas sword("", "MyNewPassword" );

if (Done==true)

Console.WriteLi ne("password for Simon changed");

else

Console.WriteLi ne("Failed to change password for Simon");
if (Simon.IsPasswo rdCorrect("what pw"))

Console.WriteLi ne("Verified ");

else

Console.WriteLi ne("NOT Verified ");

Console.ReadLin e();

}

}
Nov 17 '05 #1
3 2014
SP

"Roy Gourgi" <ro***@videotro n.ca> wrote in message
news:nO******** ***********@wag ner.videotron.n et...
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.ChangePas sword("", "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******** ********@tk2msf tngp13.phx.gbl. ..

"Roy Gourgi" <ro***@videotro n.ca> wrote in message
news:nO******** ***********@wag ner.videotron.n et...
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.ChangePas sword("", "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***@videotro n.ca> wrote in message
news:2C******** ***********@wag ner.videotron.n et...
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******** ********@tk2msf tngp13.phx.gbl. ..

"Roy Gourgi" <ro***@videotro n.ca> wrote in message
news:nO******** ***********@wag ner.videotron.n et...
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.ChangePas sword("", "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
3201
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 password (plain text): 1) Validate that the password is correct for that user *without actually logging in*. 2) If the password is valid, return a list of all the groups the user belongs to. Otherwise, return some error string.
14
8071
by: John Davis | last post by:
Anyone knows how to create the username/password authorization dialog in ASP? Thanks, John
7
2918
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 authentication in a hash table: Key: my email address Value: hash_function(my plan text password)
3
13389
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" value="server=192.12.12.1;database=mydb;user=dbuser;password=mypassword" /> However I don't like to store my password in plain text. I played around with aspnet_setreg.exe and I followed those instructions:
8
3629
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 ( ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemNetAuthenticationManagerClassTopic.htm ). I have also download and tried to use the following CsharpHttp executable in an attempt to find my problem:...
2
8724
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 would run psql for each stored procedure which needs to be updated. Is there a way to specify that password somehow in a command line like isql ( sybase cli client ) does?
2
4488
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? I'm trying to figure out the best way to handle domain users to log into an .asp application tied with SQL Server 2000 on the back end since I keep reading that windows authentication is better practice to log into SQL Server. Thanks in...
5
1913
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 Login in the page and set its Visible = False instead put my own username and 3 password on the form. Then I checked 2nd and 3rd password seperately and passed username and password to Login control via its Username and Password properties but...
9
15517
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 check the password. The thing is I can't access the password attribute to compare with the user's password provided.
3
5037
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 user has the "User must change password" flag set in Active Directory, ValidateUser() always returns false if that user wants to log in.
0
8457
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, 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...
0
8365
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8646
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7390
agi2029
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...
1
6203
isladogs
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...
0
4200
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1778
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.