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 / Security / December 2005

Tip: Looking for answers? Try searching our database.

How to  get  of last created user using CreateUserWizard?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Rodusa - 22 Jul 2005 22:44 GMT
Could someone please recommend the best way and how to obtain the last
inserted userid of users (security) table using the Button click event
of CreateUserWizard? In classic Asp and Asp.net 1.x I used the
@@identity to get the last inserted record of my custom table, but now
I don't know how Asp.net does that. I would like to understand how it
works behind the scenes, the sequence of processing. I saw that there
is an event called createuser in CreateUserWizard control which is
fired after the user is created. Is this the best place to implement
the get the last userid?  In addition, is it safe? Does it garantee
that no other user will get that userid and that locks that value to
used in this same event?

Thanks
Rod
Brock Allen - 22 Jul 2005 22:56 GMT
The CreateUserWizard fires a UserCreated event. Once that's fired, you can
access the Username and Password properties of the control. With the Username
if you need to you should be able to call into the Membership class to get
anything else you need.

-Brock
DevelopMentor
http://staff.develop.com/ballen

> Could someone please recommend the best way and how to obtain the last
> inserted userid of users (security) table using the Button click event
[quoted text clipped - 9 lines]
>
> Thanks Rod
Rodusa - 25 Jul 2005 17:22 GMT
Brock, I am new to security in Asp.net 2.0. Can you provide some
example of how to get the last created userid using the
membershipclass?

Thank you

Rod
> The CreateUserWizard fires a UserCreated event. Once that's fired, you can
> access the Username and Password properties of the control. With the Username
[quoted text clipped - 18 lines]
> >
> > Thanks Rod
Brock Allen - 25 Jul 2005 17:41 GMT
<asp:CreateUserWizard runat=server ID=_createUser OnCreatedUser="_createUser_CreatedUser"></asp:CreateUserWizard>

<script runat="server">
   protected void _createUser_CreatedUser(object sender, EventArgs e)
   {
       string name = _createUser.UserName;
       MembershipUser user = Membership.GetUser(name);
       object key = user.ProviderUserKey;
   }
</script>

-Brock
DevelopMentor
http://staff.develop.com/ballen

> Brock, I am new to security in Asp.net 2.0. Can you provide some
> example of how to get the last created userid using the
[quoted text clipped - 24 lines]
>>>
>>> Thanks Rod
Rodusa - 25 Jul 2005 19:56 GMT
I see that you assume that the the login name should be unique. Anyhow,
this is perfect and works great.

Thanks for your fast response.

Rod
Brock Allen - 25 Jul 2005 20:10 GMT
The login name is unique within the scope of the application. That's the
Membership model.

-Brock
DevelopMentor
http://staff.develop.com/ballen

> I see that you assume that the the login name should be unique.
> Anyhow, this is perfect and works great.
>
> Thanks for your fast response.
>
> Rod
Mateusz Kierepka - 29 Dec 2005 07:39 GMT
I have one additional question:
How can I use only email instead using UserID? I try to set
RequireEmail="False" and use only UserName, but validation always says
your's email is in wrong format...

Regards
Mateusz www.Kierepka.pl ;)
Dominick Baier [DevelopMentor] - 29 Dec 2005 08:53 GMT
Hi,

you can set email requirements on the control and the provider - have you
set both??

---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

> I have one additional question:
> How can I use only email instead using UserID? I try to set
[quoted text clipped - 3 lines]
> Mateusz www.Kierepka.pl ;)
> *** Sent via Developersdex http://www.developersdex.com ***

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.