How do I get the UserId from aspnet_Users after CreateUser() to use as a foreign key in another Table?
I'm using 'CreateUser()' to insert a new user... but in the same event I want to retrieve the new created 'UserId' from 'aspnet_Users' and insert it into another table as a foreign key.
Many thanks.
.NET ProgrammingEditors IDEsMicrosoft SQL Server 2005
I've been following a tutorial on www.asp.net and the username doen't have to be unique. Is there any other way of doing it or do you think it'd best to make unique usernames a requirement?
Thanks
robaherne
ASKER
I'm quite happy to set it so that a new member requires a unique user name but how do I do that?
When catching a 'MembershipCreateUserException' one of the cases for an error message is as follows...
case MembershipCreateStatus.DuplicateUserName: return "There already exists a user with this username.";
This implies I can set the membership provider to only allow unique usernames. But all I can see in the Web.Config provider settings is...
requiresUniqueEmail="true"
but no requiresUniqueUserName option.
robaherne
ASKER
My mistake... somehow I have created to users with the same name but now it won't let me.
Thanks