1: namespace BusinessApplication2.Web
2: {
3: [EnableClientAccess]
4: public class UserRegistrationService : DomainService
5: {
6: // NOTE: This is a sample code to get your application started. In the production code you would
7: // want to provide a mitigation against a denial of service attack by providing CAPTCHA
8: // control functionality or verifying user's email address.
9:
10: public void AddUser(UserInformation user)
11: {
12: MembershipCreateStatus createStatus;
13:
14: // NOTE: ASP.NET by default uses SQL Server Express to create the user database.
15: // CreateUser will fail if you do not have SQL Server Express installed.
16:
17: Membership.CreateUser(user.UserName, user.Password, user.Email, user.Question, user.Answer, true, null, out createStatus);
18: if (createStatus != MembershipCreateStatus.Success)
19: {
20: throw new DomainServiceException(ErrorCodeToString(createStatus));
21: }
22: }
23:
24: // other methods exist here
25: // ...
26: }
27: }