On Wed, 7 Jun 2006 09:15:02 -0700, Sherman KB
<ShermanKB@discussions.microsoft.com> wrote:
In this case, Transaction Scope's are your friend. You can read about
it here:
http://msdn2.microsoft.com/en-us/ms172152.aspx
Your code should look something like what I have below. (I even
tested it) With the throw in, the user doesn't get added even though
the CreateUser call is made successfully. (as I had hoped).
protected void Button1_Click(object sender, EventArgs e)
{
using (TransactionScope scope = new TransactionScope())
{
MembershipCreateStatus mstatus;
Membership.CreateUser("newuseryyy", "pass@word",
"peter@Peterkellner.net", "q", "a", true, out mstatus);
throw new ApplicationException("aborting, user should not
be added");
scope.Complete();
}
Good Luck
Peter Kellner
http://peterkellner.net
|