同じコントローラー内の[HttpPost]
アクションからアクションにリダイレクトしたい。[HttpGet]
出来ますか?
ログインは複雑であり、典型的なログオン機能ではないため、同じコードをログイン用に書き直さないようにしています。
これは私のコードです:
[HttpGet]
public ActionResult Login(){
return View();
}
[HttpPost]
public ActionResult Login(LoginModel model)
{
//search user and create sesion
//...
if (registered)
{
return this.RedirectToAction("Home","Index");
}else{
return this.RedirectToAction("Home", "signIn");
}
}
[HttpGet]
public ActionResult signIn(){
return View();
}
[HttpGet]
public ActionResult signInUserModel model)
{
//Register new User
//...
if (allOk)
{
LoginModel loginModel = new LoginModel();
loginModel.User = model.User;
loginModel.password = model.password;
//next line doesn't work!!!!!
return this.RedirectToAction("Home","Login", new { model = loginModel);
}else{
//error
//...
}
}
どんな助けでも大歓迎です。
ありがとう