473,587 Members | 2,448 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

UserID and Password Authentication using Web Service

Hi Pals,
I am a starter to web services. I have a requirement.
I want to develop a web service, which accepts userid and password from the
user and checks it with the MS Access database. If the userid and password
found correct in the database, it must return the address of the person in
the XML format.
Can any one please give me the code, so that I can modify it to fit to my
project.
Thanks in Advance..

--
Rgds,
Sang
Nov 21 '05 #1
3 2615
Dear Sangeetha Nagaraj,

Here's the code:

Database Name : DB1.MDB
Table Name : CUSTOMER

[WebMethod(Descr iption="Get Employee Info")]
public string GetUserInfo( string userId , string password )
{
private OleDbConnection conn;
conn=new OleDbConnection ("PROVIDER=Micr osoft.Jet.OLEDB .4.0;Data
Source=C:\\DB1. MDB");
conn.Open();

string XMLFormat ;
string command = "select NAME , AGE , ADDRESS1 , ADDRESS2 , CITY , STATE ,
ZIP , TEL , EMAIL from CUSTOMER WHERE USERID = '" + userId + "' AND PASSWORD
= '" + password + "'";
OleDbCommand cmd=new OleDbCommand(co mmand,conn);
OleDbDataReader rdr;
rdr=cmd.Execute Reader();
bool ret = rdr.Read();
if ( ret )
{
XMLFormat = "<DETAILS>\ n";
XMLFormat += "<NAME>"+rdr.Ge tValue(0).ToStr ing()+"</NAME>\n";
XMLFormat += "<AGE>"+rdr.Get Value(1).ToStri ng()+"</AGE>\n";
XMLFormat += "<ADDRESS1>"+rd r.GetValue(2).T oString()+"</ADDRESS1>\n";
XMLFormat += "<ADDRESS2>"+rd r.GetValue(3).T oString()+"</ADDRESS2>\n";
XMLFormat += "<CITY>"+rdr.Ge tValue(4).ToStr ing()+"</CITY>\n";
XMLFormat += "<STATE>"+rdr.G etValue(5).ToSt ring()+"</STATE>\n";
XMLFormat += "<ZIP>"+rdr.Get Value(6).ToStri ng()+"</ZIP>\n";
XMLFormat += "<TEL>"+rdr.Get Value(7).ToStri ng()+"</TEL>\n";
XMLFormat += "<EMAIL>"+rdr.G etValue(8).ToSt ring()+"</EMAIL>\n";
}
else
XMLFormat= "" ;

rdr.Close();
return XMLForat;
}

"Sangeetha Nagaraj" wrote:
Hi Pals,
I am a starter to web services. I have a requirement.
I want to develop a web service, which accepts userid and password from the
user and checks it with the MS Access database. If the userid and password
found correct in the database, it must return the address of the person in
the XML format.
Can any one please give me the code, so that I can modify it to fit to my
project.
Thanks in Advance..

--
Rgds,
Sang

Nov 21 '05 #2
Hi John,
Can you please give me a crisp note about the code.
"John Paul. A" wrote:
Dear Sangeetha Nagaraj,

Here's the code:

Database Name : DB1.MDB
Table Name : CUSTOMER

[WebMethod(Descr iption="Get Employee Info")]
public string GetUserInfo( string userId , string password )
{
private OleDbConnection conn;
conn=new OleDbConnection ("PROVIDER=Micr osoft.Jet.OLEDB .4.0;Data
Source=C:\\DB1. MDB");
conn.Open();

string XMLFormat ;
string command = "select NAME , AGE , ADDRESS1 , ADDRESS2 , CITY , STATE ,
ZIP , TEL , EMAIL from CUSTOMER WHERE USERID = '" + userId + "' AND PASSWORD
= '" + password + "'";
OleDbCommand cmd=new OleDbCommand(co mmand,conn);
OleDbDataReader rdr;
rdr=cmd.Execute Reader();
bool ret = rdr.Read();
if ( ret )
{
XMLFormat = "<DETAILS>\ n";
XMLFormat += "<NAME>"+rdr.Ge tValue(0).ToStr ing()+"</NAME>\n";
XMLFormat += "<AGE>"+rdr.Get Value(1).ToStri ng()+"</AGE>\n";
XMLFormat += "<ADDRESS1>"+rd r.GetValue(2).T oString()+"</ADDRESS1>\n";
XMLFormat += "<ADDRESS2>"+rd r.GetValue(3).T oString()+"</ADDRESS2>\n";
XMLFormat += "<CITY>"+rdr.Ge tValue(4).ToStr ing()+"</CITY>\n";
XMLFormat += "<STATE>"+rdr.G etValue(5).ToSt ring()+"</STATE>\n";
XMLFormat += "<ZIP>"+rdr.Get Value(6).ToStri ng()+"</ZIP>\n";
XMLFormat += "<TEL>"+rdr.Get Value(7).ToStri ng()+"</TEL>\n";
XMLFormat += "<EMAIL>"+rdr.G etValue(8).ToSt ring()+"</EMAIL>\n";
}
else
XMLFormat= "" ;

rdr.Close();
return XMLForat;
}

"Sangeetha Nagaraj" wrote:
Hi Pals,
I am a starter to web services. I have a requirement.
I want to develop a web service, which accepts userid and password from the
user and checks it with the MS Access database. If the userid and password
found correct in the database, it must return the address of the person in
the XML format.
Can any one please give me the code, so that I can modify it to fit to my
project.
Thanks in Advance..

--
Rgds,
Sang

Nov 21 '05 #3
Dear Sangeetha Nagaraj,

Here are the steps..
1. Create the Database in MS Access
2. Create the database connection and open the connection.
3. Create command and the reader to read from the database.
4. create a string which does XML formatting manually.
5. Populate the string and return it.

Thats it.. It is simple and cool...

"Sangeetha Nagaraj" wrote:
Hi John,
Can you please give me a crisp note about the code.
"John Paul. A" wrote:
Dear Sangeetha Nagaraj,

Here's the code:

Database Name : DB1.MDB
Table Name : CUSTOMER

[WebMethod(Descr iption="Get Employee Info")]
public string GetUserInfo( string userId , string password )
{
private OleDbConnection conn;
conn=new OleDbConnection ("PROVIDER=Micr osoft.Jet.OLEDB .4.0;Data
Source=C:\\DB1. MDB");
conn.Open();

string XMLFormat ;
string command = "select NAME , AGE , ADDRESS1 , ADDRESS2 , CITY , STATE ,
ZIP , TEL , EMAIL from CUSTOMER WHERE USERID = '" + userId + "' AND PASSWORD
= '" + password + "'";
OleDbCommand cmd=new OleDbCommand(co mmand,conn);
OleDbDataReader rdr;
rdr=cmd.Execute Reader();
bool ret = rdr.Read();
if ( ret )
{
XMLFormat = "<DETAILS>\ n";
XMLFormat += "<NAME>"+rdr.Ge tValue(0).ToStr ing()+"</NAME>\n";
XMLFormat += "<AGE>"+rdr.Get Value(1).ToStri ng()+"</AGE>\n";
XMLFormat += "<ADDRESS1>"+rd r.GetValue(2).T oString()+"</ADDRESS1>\n";
XMLFormat += "<ADDRESS2>"+rd r.GetValue(3).T oString()+"</ADDRESS2>\n";
XMLFormat += "<CITY>"+rdr.Ge tValue(4).ToStr ing()+"</CITY>\n";
XMLFormat += "<STATE>"+rdr.G etValue(5).ToSt ring()+"</STATE>\n";
XMLFormat += "<ZIP>"+rdr.Get Value(6).ToStri ng()+"</ZIP>\n";
XMLFormat += "<TEL>"+rdr.Get Value(7).ToStri ng()+"</TEL>\n";
XMLFormat += "<EMAIL>"+rdr.G etValue(8).ToSt ring()+"</EMAIL>\n";
}
else
XMLFormat= "" ;

rdr.Close();
return XMLForat;
}

"Sangeetha Nagaraj" wrote:
Hi Pals,
I am a starter to web services. I have a requirement.
I want to develop a web service, which accepts userid and password from the
user and checks it with the MS Access database. If the userid and password
found correct in the database, it must return the address of the person in
the XML format.
Can any one please give me the code, so that I can modify it to fit to my
project.
Thanks in Advance..

--
Rgds,
Sang

Nov 21 '05 #4

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

Similar topics

1
3945
by: Carl Ogawa | last post by:
The following will stop to open test.pl due to using param('userid') and param('pwd'). Is there an alternative way to get data from HTML file to CGI file? I have to do this in the particular situation. -------- html file --------- <form name = "form3" action = "http://localhost/scripts/test.pl" method = post> Name: <INPUT TYPE = text NAME =...
7
2916
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)
0
2418
by: Joey Edelstein | last post by:
Hi, We are trying to add a Client Certificate support for our web app that emulates a hardware device web app. The hardware uses a 2 factors authentication, which requires a Web Service client to send: Client Certificate and Username / password. We are using a Web Service provider which uses IIS 5.1 as HTTP server. IIS is set to require...
3
1776
by: Funky | last post by:
Hi, I have developed an ASP.NET application which has been running in production for around 3 months without any major glitches. Recently, a user was attempting to upload a rather large CSV file and ran into a strange problem. After roughly 3 minutes of processing, the application reprompted the user for their user name and password (NT...
1
2242
by: Hardy Wang | last post by:
Hi, I have my own user table with definition like UserID int not null primary key, Username varchar(50) not null, Password varchar(50) not null, Firstname varchar(50) not null, Lastname varchar(50) not null, Email varchar(50) not null, ......
2
522
by: willyd61 | last post by:
Hello Everyone! Newbie here... I can't configure any remote clients to connect to my DB2 server, I am able to run and connect local from the server, but if I try to connect with a user and specify password it fails with the dreaded SQL30082N. I have checked all parameters, there is the servicename registered in /etc/services the dbm cfg is...
9
15507
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
5033
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.
2
3920
by: ThatsIT.net.au | last post by:
I am using Forms Authentication but I want to keep more info on user than forms authentication keeps. I thought of 2 ways of doing this 1. To have a linked table holding other data, but for this I need to be able to get the userID of the logged on user. how do I do this. 2. the other Idea I had was to add more fields to the forms...
0
8347
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7973
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...
0
6626
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...
1
5718
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...
0
5394
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...
0
3844
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...
0
3879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2358
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
1
1454
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.