Authentication in Asp.Net 2.0. Please, I need help. Thank You.

  • Thread starter Miguel Dias Moura
  • Start date
M

Miguel Dias Moura

Hello,

I am working on an Asp.Net 2.0 / SQL 2005 web project where:
1. All users must login.
2. There will be two user types: student and professor.
The students and professors are not related.

IMPORTANT:
All students and professors will have a name, phone, ...
However, other information is specific to a user type.
Consider the following example:

INFORMATION on each student:
Name, Email, Phone, Age

INFORMATION on each professor:
Name, Email, Phone, Address, Position

To avoid blank fields on my database I created the following tables:

USERS_AUTH > Authentication information for all users.
FIELDS: [User_ID] (PK), [Username], [Password], [Role]

USERS_INFO > Personal information on students and professors
FIELDS: [UserInfo_ID] (PK), [User_ID] (FK), [Name],
[Phone]

STUDENTS > Personal information specific to students
Fields: [Student_ID] (PK), [UserInfo_ID] (FK), [Age]

PROFESSORS > Personal information specific to students
Fields: [Professor_ID] (PK), [UserInfo_ID] (FK), [Age]

- 'PK' and 'FK' stands for primary key and foreign key, respectively.
- [Role] in USERS_AUTH can be 'Student' or 'Professor'.

My database structure becomes as follows:

USERS_AUTH
|
USERS_INFO
| |
STUDENTS PROFESSORS

I created this structure based on the following:
a) Table USERS_AUTH is to be used by Membership API.
I believe I can't or I shouldn't put USERS_AUTH and USERS_INFO
together.
b) USERS_INFO, STUDENTS and PROFESSORS are to be used in
Personalization.
c) I created STUDENTS and PROFESSORS to avoid blank fields in my
database.


MY QUESTIONS ARE:

1. Is this the way to do it?
Are my assumptions in (a), (b) and (c) correct?

2. What are all the possible fields to be used on the table USERS_AUTH?

USERS_AUTH is to be used by Membership API.

I read some online documents and MSDN.

Sometimes there is the field PasswordQuestion other times there
isn't.
Sometimes I see the field Role and other times there isn't.
I might be reading Beta 1 and Final release documents.

This is why I am asking for all fields to be used by Membership API.

3. I need to make user information available after login, for example:
- To display it on a page.
- To hide or show a web page part.
- To use in any other way.

User information differs from student and professor:
- USER_INFO and STUDENTS fields if the user is a student (Role =
Student)
- USER_INFO and PROFESSORS fields for students (Role = Professor).

How do I get this info?
How to I relate this with Personalization methods in Asp.Net 2.0.

I've read everything I could find but I am having problems putting this
together. I hope I, successfully, explained my problem.

Could, someone, please help me out?

Thank You Very Much,
Miguel
 
O

Otis Mukinfus

On Tue, 3 Jan 2006 01:10:20 +0000, "Miguel Dias Moura"

I would use Forms Authentication.
See the help docs on Forms Authentication. There are several built-in
controls for handling it and several books with examples of it's use.

You should not keep the authentication data and the user data in the
same object.
Hello,

I am working on an Asp.Net 2.0 / SQL 2005 web project where:
1. All users must login.
2. There will be two user types: student and professor.
The students and professors are not related.

IMPORTANT:
All students and professors will have a name, phone, ...
However, other information is specific to a user type.
Consider the following example:

INFORMATION on each student:
Name, Email, Phone, Age

INFORMATION on each professor:
Name, Email, Phone, Address, Position

To avoid blank fields on my database I created the following tables:

USERS_AUTH > Authentication information for all users.
FIELDS: [User_ID] (PK), [Username], [Password], [Role]

USERS_INFO > Personal information on students and professors
FIELDS: [UserInfo_ID] (PK), [User_ID] (FK), [Name],
[Phone]

STUDENTS > Personal information specific to students
Fields: [Student_ID] (PK), [UserInfo_ID] (FK), [Age]

PROFESSORS > Personal information specific to students
Fields: [Professor_ID] (PK), [UserInfo_ID] (FK), [Age]

- 'PK' and 'FK' stands for primary key and foreign key, respectively.
- [Role] in USERS_AUTH can be 'Student' or 'Professor'.

My database structure becomes as follows:

USERS_AUTH
|
USERS_INFO
| |
STUDENTS PROFESSORS

I created this structure based on the following:
a) Table USERS_AUTH is to be used by Membership API.
I believe I can't or I shouldn't put USERS_AUTH and USERS_INFO
together.
b) USERS_INFO, STUDENTS and PROFESSORS are to be used in
Personalization.
c) I created STUDENTS and PROFESSORS to avoid blank fields in my
database.


MY QUESTIONS ARE:

1. Is this the way to do it?
Are my assumptions in (a), (b) and (c) correct?

2. What are all the possible fields to be used on the table USERS_AUTH?

USERS_AUTH is to be used by Membership API.

I read some online documents and MSDN.

Sometimes there is the field PasswordQuestion other times there
isn't.
Sometimes I see the field Role and other times there isn't.
I might be reading Beta 1 and Final release documents.

This is why I am asking for all fields to be used by Membership API.

3. I need to make user information available after login, for example:
- To display it on a page.
- To hide or show a web page part.
- To use in any other way.

User information differs from student and professor:
- USER_INFO and STUDENTS fields if the user is a student (Role =
Student)
- USER_INFO and PROFESSORS fields for students (Role = Professor).

How do I get this info?
How to I relate this with Personalization methods in Asp.Net 2.0.

I've read everything I could find but I am having problems putting this
together. I hope I, successfully, explained my problem.

Could, someone, please help me out?

Thank You Very Much,
Miguel

Otis Mukinfus
http://www.otismukinfus.com
http://www.tomchilders.com
 
C

clintonG

I think its smarter to redesign your database design to function with
ASP.NET 2.0 Membership, Roles and Profiles.
Start by building this MSDN tutorial [1] and see if you don't agree after
you understand how easy it has become.

<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/

[1]
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/paght000014.asp

Miguel Dias Moura said:
Hello,

I am working on an Asp.Net 2.0 / SQL 2005 web project where:
1. All users must login.
2. There will be two user types: student and professor.
The students and professors are not related.

IMPORTANT:
All students and professors will have a name, phone, ...
However, other information is specific to a user type.
Consider the following example:

INFORMATION on each student:
Name, Email, Phone, Age

INFORMATION on each professor:
Name, Email, Phone, Address, Position

To avoid blank fields on my database I created the following tables:

USERS_AUTH > Authentication information for all users.
FIELDS: [User_ID] (PK), [Username], [Password], [Role]

USERS_INFO > Personal information on students and professors
FIELDS: [UserInfo_ID] (PK), [User_ID] (FK), [Name], [Phone]

STUDENTS > Personal information specific to students
Fields: [Student_ID] (PK), [UserInfo_ID] (FK), [Age]

PROFESSORS > Personal information specific to students
Fields: [Professor_ID] (PK), [UserInfo_ID] (FK), [Age]

- 'PK' and 'FK' stands for primary key and foreign key, respectively.
- [Role] in USERS_AUTH can be 'Student' or 'Professor'.

My database structure becomes as follows:

USERS_AUTH
|
USERS_INFO
| |
STUDENTS PROFESSORS

I created this structure based on the following:
a) Table USERS_AUTH is to be used by Membership API.
I believe I can't or I shouldn't put USERS_AUTH and USERS_INFO together.
b) USERS_INFO, STUDENTS and PROFESSORS are to be used in Personalization.
c) I created STUDENTS and PROFESSORS to avoid blank fields in my database.


MY QUESTIONS ARE:
1. Is this the way to do it?
Are my assumptions in (a), (b) and (c) correct?

2. What are all the possible fields to be used on the table USERS_AUTH?

USERS_AUTH is to be used by Membership API.

I read some online documents and MSDN.

Sometimes there is the field PasswordQuestion other times there isn't.
Sometimes I see the field Role and other times there isn't.
I might be reading Beta 1 and Final release documents.

This is why I am asking for all fields to be used by Membership API.

3. I need to make user information available after login, for example:
- To display it on a page.
- To hide or show a web page part.
- To use in any other way.

User information differs from student and professor:
- USER_INFO and STUDENTS fields if the user is a student (Role =
Student)
- USER_INFO and PROFESSORS fields for students (Role = Professor).

How do I get this info?
How to I relate this with Personalization methods in Asp.Net 2.0.

I've read everything I could find but I am having problems putting this
together. I hope I, successfully, explained my problem.

Could, someone, please help me out?

Thank You Very Much,
Miguel
 
M

Matthew

You need to use: aspnet_regsql

To create the tables and such for forms authentication. Do it the MS
way, it will make your life a lot easier.

Then you can create web.config entries and manage roles and membership.

EX.
<connectionStrings>
<add name="ClientsDB" connectionString="....."
ProviderName="System.Data.SqlClient" />
</connectionStrings>

<system.web>

<membership defaultProvider="MySqlMembershipProvider" >
<providers>
<clear/>
<add name="MySqlMembershipProvider"
connectionStringName="ClientsDB"
applicationName="/"
passwordFormat="Hashed"
type="System.Web.Security.SqlMembershipProvider" />
</providers>
</membership>

<roleManager enabled="true" defaultProvider="MySqlRoleManager">
<providers>
<clear/>
<add name="MySqlRoleManager"
type="System.Web.Security.SqlRoleProvider"
connectionStringName="ClientsDB"
applicationName="/" />
</providers>
</roleManager>

</system.web>
I think its smarter to redesign your database design to function with
ASP.NET 2.0 Membership, Roles and Profiles.
Start by building this MSDN tutorial [1] and see if you don't agree after
you understand how easy it has become.

<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee.com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/

[1]
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/paght000014.asp

Miguel Dias Moura said:
Hello,

I am working on an Asp.Net 2.0 / SQL 2005 web project where:
1. All users must login.
2. There will be two user types: student and professor.
The students and professors are not related.

IMPORTANT:
All students and professors will have a name, phone, ...
However, other information is specific to a user type.
Consider the following example:

INFORMATION on each student:
Name, Email, Phone, Age

INFORMATION on each professor:
Name, Email, Phone, Address, Position

To avoid blank fields on my database I created the following tables:

USERS_AUTH > Authentication information for all users.
FIELDS: [User_ID] (PK), [Username], [Password], [Role]

USERS_INFO > Personal information on students and professors
FIELDS: [UserInfo_ID] (PK), [User_ID] (FK), [Name], [Phone]

STUDENTS > Personal information specific to students
Fields: [Student_ID] (PK), [UserInfo_ID] (FK), [Age]

PROFESSORS > Personal information specific to students
Fields: [Professor_ID] (PK), [UserInfo_ID] (FK), [Age]

- 'PK' and 'FK' stands for primary key and foreign key, respectively.
- [Role] in USERS_AUTH can be 'Student' or 'Professor'.

My database structure becomes as follows:

USERS_AUTH
|
USERS_INFO
| |
STUDENTS PROFESSORS

I created this structure based on the following:
a) Table USERS_AUTH is to be used by Membership API.
I believe I can't or I shouldn't put USERS_AUTH and USERS_INFO together.
b) USERS_INFO, STUDENTS and PROFESSORS are to be used in Personalization.
c) I created STUDENTS and PROFESSORS to avoid blank fields in my database.


MY QUESTIONS ARE:
1. Is this the way to do it?
Are my assumptions in (a), (b) and (c) correct?

2. What are all the possible fields to be used on the table USERS_AUTH?

USERS_AUTH is to be used by Membership API.

I read some online documents and MSDN.

Sometimes there is the field PasswordQuestion other times there isn't.
Sometimes I see the field Role and other times there isn't.
I might be reading Beta 1 and Final release documents.

This is why I am asking for all fields to be used by Membership API.

3. I need to make user information available after login, for example:
- To display it on a page.
- To hide or show a web page part.
- To use in any other way.

User information differs from student and professor:
- USER_INFO and STUDENTS fields if the user is a student (Role =
Student)
- USER_INFO and PROFESSORS fields for students (Role = Professor).

How do I get this info?
How to I relate this with Personalization methods in Asp.Net 2.0.

I've read everything I could find but I am having problems putting this
together. I hope I, successfully, explained my problem.

Could, someone, please help me out?

Thank You Very Much,
Miguel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top