I'm calling another controller and action method here
[HttpPost]
public ActionResult Index(LoginModel loginModel)
{
if (ModelState.IsValid)
{ some lines of code . bla bla bla
return RedirectToAction("indexaction","premiumcontroller");
}
}
Now, what happens is the indexaction of premiumcontroller is now executed.
How can i pass the values of loginmodel (or the loginmodel object) to the premiumcontroller? i cant figure it out. Thanks.
I'm using asp.net mvc 3.
you can use new keyword to pass the values in the controller action...
in your other controller
You could pass them as query string parameters:
and inside the
index
action ofpremium
controller:Another possibility is to use TempData:
and inside the
index
action ofpremium
controller: