Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > How to get of last created user using CreateUserWizard?

Reply
Thread Tools

How to get of last created user using CreateUserWizard?

 
 
Rodusa
Guest
Posts: n/a
 
      07-22-2005
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

 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      07-22-2005
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
> 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
>




 
Reply With Quote
 
 
 
 
Rodusa
Guest
Posts: n/a
 
      07-25-2005
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
Brock Allen wrote:
> 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
> > 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
> >


 
Reply With Quote
 
Brock Allen
Guest
Posts: n/a
 
      07-25-2005
<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
> membershipclass?
>
> Thank you
>
> Rod
> Brock Allen wrote:
>> 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 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
>>>




 
Reply With Quote
 
Rodusa
Guest
Posts: n/a
 
      07-25-2005
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

 
Reply With Quote
 
Brock Allen
Guest
Posts: n/a
 
      07-25-2005
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
>




 
Reply With Quote
 
Mateusz Kierepka
Guest
Posts: n/a
 
      12-29-2005
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

*** Sent via Developersdex http://www.developersdex.com ***
 
Reply With Quote
 
Dominick Baier [DevelopMentor]
Guest
Posts: n/a
 
      12-29-2005
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
> RequireEmail="False" and use only UserName, but validation always says
> your's email is in wrong format...
> Regards
> Mateusz www.Kierepka.pl
> *** Sent via Developersdex http://www.developersdex.com ***
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
OleDbDataAdapter created in code behaves differently from one created by wizard. tom c ASP .Net 6 09-06-2006 04:46 PM
are the objects created in the stack guarranted to have been created? jimjim C++ 12 06-03-2005 12:57 PM
How to get user's first and last name from NT login using ASP? GoCMS ASP General 2 01-14-2005 07:29 PM
schemalocation entry in XML created by castor created sources? Ulf Heyder XML 0 10-16-2003 02:14 PM



Advertisments