Welcome  This site hosts database tutorials and a few volunteer sub-websites.  
Login
Skip Navigation Links
Home
Database Tutorials
Become a Member
My Account
Contact Us
Portfolio
KRL Emails - Private
Rovers - Private
Shufflers
RCHS Reunion
FUMC Choir Music
Garden Club - Private
Award

Showing logged on user only their data - tutorial description

Take the tutorial   Back to the tutorials list

Bullet Introduction

In many situations a website is set up to accept memberships, and members can then have their own Username and password, giving them access to their own private data on the website.

An example of this is Ownertrades.com , a site created and run by Homepage Doctor that allows users to list their Marriott timeshares for exchange, sale, or rental. Each member necessarily has to have access to pages where their own data is available to them so that they can add to it, modify it, or delete it.

This is generally accomplished by creating a single "Manage my data" page that, when a user goes there, he is presented with only his own data. So the site could have thousands of members, but a single website page is all that is needed for each of those members to work with their own private data.

This tutorial does not take you through the process of setting up a membership website in the first place. If that is what you need, then make use of the material in the last of the free tutorials on this website titled "What you need to create a membership website".

Bullet Prerequisite for this tutorial

This tutorial assumes you have already created a membership website, complete with ability for users to logon. In having done so, the App_Data folder of your website contains a membership database titled "ASPNETDB.MDF" that contains all the tables your website needs for managing memberships, passwords, logins etc.

We also assume you have created a database diagram for that database (If you have not, the first members-only tutorial titled "Setting up and using a multi-table database" shows you how to do that).

Having done so, the proper way to tie a user's data to their UserID in the membership database is via a one-to-many relationship between the UserID of the aspnet_Users table and the personal data of the user which would be contained in one or more tables which you have added to the membership database.

The diagam below shows how a single table containing just first and last names of a user would be tied to the aspnet_Users table (many other tables that are part of the diagram are not shown below).

usertalbe

A webpage having a gridview drawing data from the PersonalDataTestTable above would normally bring up the first and last names of all the users.

Bullet In this tutorial, you will learn how automatically bring up only the data belonging to the logged-on user.

Take the tutorial

Home   DatabaseTutorials   BecomeAMember   ContactUs    MyAccount   Portfolio   KRLEmails   Rovers   Shufflers   RCHS55Reunion
All graphics on this site are copyrighted