connect login control to my application

X

xke

ASP.NET 2.0

Which field from aspnet_Users table should I use as a foreign key in
the related tables in my application?

Ex. I have a message board app in old asp and there is a table Topics
containing all the messages posted by users. And I had MsgID as pk and
UserId fk to identify the user. I am planning to move everything
to .net

I've always used UserID but in the new model it looks like UserName is
a better choice because of User.Identity.Name. Does User collection
keeps information about UserID?

When I insert a new record looks like it's better to use UserName
directly, so it means all the table should have UserName as fk instead
of UserID. Am I right?

Thanks
 
G

Guest

ASP.NET 2.0

Which field from aspnet_Users table should I use as a foreign key in
the related tables in my application?

Ex. I have a message board app in old asp and there is a table Topics
containing all the messages posted by users. And I had MsgID as pk and
UserId fk to identify the user. I am planning to move everything
to .net

I've always used UserID but in the new model it looks like UserName is
a better choice because of User.Identity.Name. Does User collection
keeps information about UserID?

When I insert a new record looks like it's better to use UserName
directly, so it means all the table should have UserName as fk instead
of UserID. Am I right?

Thanks

It depends on your implementation. The UserId value could be either
the string value of numeric UserId, or a name of the user, or an email
address. The idea is to use a unique key to unambiguously identify
specific user. Most of message boards require unique name, email (and
#), and any of these fields can be used as a key.
 

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,811
Messages
2,569,693
Members
45,478
Latest member
dontilydondon

Latest Threads

Top