Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
Membership service usage sample inside ASP.NET MVC controller
public class AccountController : Controller
private readonly IMembershipService membershipService;
// service initialization is handled by IoC container
public AccountController(IMembershipService membershipService)
this.membershipService = membershipService;
// .. some other stuff ..
public ActionResult Register(RegisterModel model)
if (this.ModelSteate.IsValid)
// then passes it to the service method and checks for errors
// which returns ServiceResponse<User> with the status of operation and registered user entity
var response = this.membershipService.CreateUser(model);
if (response.Success)
FormsAuthentication.SetAuthCookie(response.Value.UserName, createPersistentCookie: false);
return RedirectToAction("Index", "Home");
return View();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.