473,513 Members | 2,736 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 2609
Dear Sangeetha Nagaraj,

Here's the code:

Database Name : DB1.MDB
Table Name : CUSTOMER

[WebMethod(Description="Get Employee Info")]
public string GetUserInfo( string userId , string password )
{
private OleDbConnection conn;
conn=new OleDbConnection("PROVIDER=Microsoft.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(command,conn);
OleDbDataReader rdr;
rdr=cmd.ExecuteReader();
bool ret = rdr.Read();
if ( ret )
{
XMLFormat = "<DETAILS>\n";
XMLFormat += "<NAME>"+rdr.GetValue(0).ToString()+"</NAME>\n";
XMLFormat += "<AGE>"+rdr.GetValue(1).ToString()+"</AGE>\n";
XMLFormat += "<ADDRESS1>"+rdr.GetValue(2).ToString()+"</ADDRESS1>\n";
XMLFormat += "<ADDRESS2>"+rdr.GetValue(3).ToString()+"</ADDRESS2>\n";
XMLFormat += "<CITY>"+rdr.GetValue(4).ToString()+"</CITY>\n";
XMLFormat += "<STATE>"+rdr.GetValue(5).ToString()+"</STATE>\n";
XMLFormat += "<ZIP>"+rdr.GetValue(6).ToString()+"</ZIP>\n";
XMLFormat += "<TEL>"+rdr.GetValue(7).ToString()+"</TEL>\n";
XMLFormat += "<EMAIL>"+rdr.GetValue(8).ToString()+"</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(Description="Get Employee Info")]
public string GetUserInfo( string userId , string password )
{
private OleDbConnection conn;
conn=new OleDbConnection("PROVIDER=Microsoft.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(command,conn);
OleDbDataReader rdr;
rdr=cmd.ExecuteReader();
bool ret = rdr.Read();
if ( ret )
{
XMLFormat = "<DETAILS>\n";
XMLFormat += "<NAME>"+rdr.GetValue(0).ToString()+"</NAME>\n";
XMLFormat += "<AGE>"+rdr.GetValue(1).ToString()+"</AGE>\n";
XMLFormat += "<ADDRESS1>"+rdr.GetValue(2).ToString()+"</ADDRESS1>\n";
XMLFormat += "<ADDRESS2>"+rdr.GetValue(3).ToString()+"</ADDRESS2>\n";
XMLFormat += "<CITY>"+rdr.GetValue(4).ToString()+"</CITY>\n";
XMLFormat += "<STATE>"+rdr.GetValue(5).ToString()+"</STATE>\n";
XMLFormat += "<ZIP>"+rdr.GetValue(6).ToString()+"</ZIP>\n";
XMLFormat += "<TEL>"+rdr.GetValue(7).ToString()+"</TEL>\n";
XMLFormat += "<EMAIL>"+rdr.GetValue(8).ToString()+"</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(Description="Get Employee Info")]
public string GetUserInfo( string userId , string password )
{
private OleDbConnection conn;
conn=new OleDbConnection("PROVIDER=Microsoft.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(command,conn);
OleDbDataReader rdr;
rdr=cmd.ExecuteReader();
bool ret = rdr.Read();
if ( ret )
{
XMLFormat = "<DETAILS>\n";
XMLFormat += "<NAME>"+rdr.GetValue(0).ToString()+"</NAME>\n";
XMLFormat += "<AGE>"+rdr.GetValue(1).ToString()+"</AGE>\n";
XMLFormat += "<ADDRESS1>"+rdr.GetValue(2).ToString()+"</ADDRESS1>\n";
XMLFormat += "<ADDRESS2>"+rdr.GetValue(3).ToString()+"</ADDRESS2>\n";
XMLFormat += "<CITY>"+rdr.GetValue(4).ToString()+"</CITY>\n";
XMLFormat += "<STATE>"+rdr.GetValue(5).ToString()+"</STATE>\n";
XMLFormat += "<ZIP>"+rdr.GetValue(6).ToString()+"</ZIP>\n";
XMLFormat += "<TEL>"+rdr.GetValue(7).ToString()+"</TEL>\n";
XMLFormat += "<EMAIL>"+rdr.GetValue(8).ToString()+"</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
3941
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...
7
2911
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...
0
2412
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...
3
1771
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...
1
2238
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...
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...
9
15480
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
5027
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...
2
3915
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...
0
7153
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
7373
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,...
1
7094
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...
0
7519
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...
0
5677
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,...
1
5079
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...
0
3230
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...
0
3218
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
452
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...

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.