62,243
社区成员




[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Register(RegisterModel model)
{
if (ModelState.IsValid)
{
// Attempt to register the user
try
{
WebSecurity.CreateUserAndAccount(model.Email, model.Password, new
{
UserName = model.UserName,
Question = model.Question,
Answer = model.Answer,
Telphone = model.Telphone
});
// WebSecurity.Login(model.Email, model.Password);
// return RedirectToAction("Index", "Home");
return View("这里写你另一个视图名称,该视图显示注册成功后的内容",model);
}
catch (MembershipCreateUserException e)
{
ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
}
}
// If we got this far, something failed, redisplay form
return View(model);
}
//
// GET: /Account/Register
[AllowAnonymous]
public ActionResult Register()
{
return View();
}
//
// POST: /Account/Register
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Register(RegisterModel model)
{
if (ModelState.IsValid)
{
// Attempt to register the user
try
{
WebSecurity.CreateUserAndAccount(model.Email, model.Password, new
{
UserName = model.UserName,
Question = model.Question,
Answer = model.Answer,
Telphone = model.Telphone
});
// WebSecurity.Login(model.Email, model.Password);
// return RedirectToAction("Index", "Home");
return RedirectToAction("Registed", "Account");
}
catch (MembershipCreateUserException e)
{
ModelState.AddModelError("", ErrorCodeToString(e.StatusCode));
}
}
// If we got this far, something failed, redisplay form
return View(model);
}
这要怎么设置呢?添加一个ActionResult ?