Ronald Abellano

Ronald Abellano

  • NA
  • 161
  • 35.7k

Pass model through RedirectToAction

Jun 30 2018 11:55 AM
 Hi, how can we pass model to another page?
I'am using ASP.Net Core2.0
The data is passed in address bar but its not showing up in the model.  
public IActionResult Error()
return RedirectToAction(nameof(ExceptionPageController.Index), "ExceptionPage", new ExceptionPageModel { ErrorMessage ="Hello World!"});
@model Webeu.Models.ExceptionPage.ExceptionPageModel
ViewData["Title"] = "Index";

<form asp-controller="Account" asp-action="Error" method="get">
<p> @Html.DisplayNameFor(m => m.ErrorMessage)</p>
<p>arigato @Html.DisplayFor(m => m.ErrorMessage)</p>

Answers (1)