Id like to know as to how to go about creating a web service that validates a registerd user to my site. Also how to register a new user to the site.

What steps shall i take in order to do this? Im using Visual Studio 2008 (.NET Framework 3.5) ASP.NET, SQL server 2005(Microsoft). If there are any examples for me that i can have a look at it would really help.

Thanks guys

Recommended Answers

All 4 Replies

First up, why a web service to validate a user? Does this really need to be done via a service for your project? Normally code in your site handles logins (unless you are using SSO, or allowing users to sign on via their Twitter/Facebook/other social site credentials).
Anyway, there are many examples on the net (Google is your friend). Here's one: http://www.sitepoint.com/net-web-services-5-steps/

hi thanks for your reply, im doing a website that sells books online. Im not sure wheter a online bookstore does validations of registerd users via the server which is why i ask. If it does how does one go about it? in my project they talk about doing a ".NET Remoting with serviced component", here it says: 'To provide methods for processing data to check login information,register new customers, serach books on categories and retrive customers bill'. sorry if im typing a whole lot of rubbish here, but i would like some advice as to how to do it.

Thanks again for the reply

All of that is normally part of the website itself. But there is absolutely no reason why it can't incorporate web services (maybe because it is intended to add APIs later for other people to use).
Registration,product searching etc is best handled as pages/code files in your project, web services would just be another layer of complexity added for no real reason unless there was some design element that requires it. From what you have said so far it doesn't sound as if they are needed on youe site.

Here is the detailed answer :

You want to:

Register new users to your website.

Validate (log in) existing users using a web service.

You will achieve this by:

Creating a SQL database to store user information.

Developing a web service in ASP.NET to handle registration and login.

Connecting the web service to your database.

Optionally consuming this service from your website front-end.

🔧 Step-by-Step Process
Step 1: Create a Database Table
Start by designing a table in SQL Server where user data will be stored. This table should include fields like:

Username

Password (you can later add encryption)

Email address

This table will be used to store and retrieve user credentials.

Step 2: Create a New ASP.NET Web Service Project
In Visual Studio 2008:

Create a new website project using the "ASP.NET Web Service" template.

This will give you a .asmx file where you will define the web service methods.

Step 3: Add a Connection to the Database
Use the web.config file to store a connection string. This allows your web service to communicate with the SQL Server database.

Step 4: Create Two Web Service Methods
Define two main methods in your service:

RegisterUser – This method accepts user details (like username, password, and email) and stores them in the database. It checks for existing usernames to avoid duplicates.

ValidateUser – This method accepts login credentials and checks if they match any record in the database. If yes, login is successful.

Step 5: Publish and Test the Service
Once you've added the logic:

Run the web service locally to test.

Use the built-in browser test interface in Visual Studio to simulate registration and login.

Step 6: Integrate with Your Front-End (Optional)
If you're building a front-end (ASP.NET Web Forms, HTML, etc.), you can:

Add a web reference to your service.

Call the RegisterUser and ValidateUser methods from the front-end forms to register or log in users.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.