views:

275

answers:

1

I'm trying to create a user using the SQL membership provider on SQL Express. When I use the TransactionScope it prompts to DTC with no apparent reason, how can I avoid it?

Here is my example code:

using (var ts = new TransactionScope())
{
    MembershipCreateStatus status;
    Membership.CreateUser(username, password, null, null, null, true, out status);

    var userProfile = ProfileBase.Create(username);

    userProfile.SetPropertyValue("Fullname", fullname);
    userProfile.Save();

    ts.Complete();
}

BTW, I checked in reflector and every membership SQL function always closes its connection.

+1  A: 

You can implement this function without a transaction as suggested here.

Eran Betzalel
The answer in your link (which appears to be 'Or Betzalel' on forums.asp.net,) doesn't answer the question...
Yoopergeek
It's not him, I posted this question from SO, I'm SharpOne.
Eran Betzalel