Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

Membership - Getting user id

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mazdotnet - 07 Sep 2007 16:08 GMT
Hi,

I like to grab the user id of the currently added user. However, I
can't find a property that would do it.

MembershipUser newUser = Membership.CreateUser(tbxUsername.Text,
tbxPassword.Text,

tbxEmail.Text, "empty",
                                                          "empty",
true, out status);

I need something that would give me the newUser.UserID (database user
id)

Also, I had to use "empty", "empty" for the password question. If I
leave it empty, it says that password question not valid. Any way
around this?

Thanks
Maz
Mark Fitzpatrick - 07 Sep 2007 19:44 GMT
As far as the id goes, I can answer that one (not the password question
though).

What you want is the ProviderUserKey property of the MembershipUser object.
The ProviderUserKey returns an object and it's your responsibility to deal
with it appropriately. In the case of using SQL Server as a membership
store, it will return a GUID so you need to make sure it's cast to that in
order to access it.

Signature

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

> Hi,
>
[quoted text clipped - 17 lines]
> Thanks
> Maz

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.