0
我在viewbag中设置一个错误消息,以便在每次回发后向用户显示,我不希望在页面重新加载或刷新时显示此错误消息。我试图将它设置为null,但它仍然显示,因为json参数仍然包含第一次提交的值。即使页面刷新后,asp.net mvc actionresult仍保留参数值?
[HttpPost]
[CustomAuthorize(Definitions.RoleAnalystManager, Definitions.RoleProjectManager)]
public ActionResult ExportReportAllMediaDetailsCsv(string json)
{
ViewBag.Error = null;
var serializer = new JavaScriptSerializer();
var reportParams = serializer.Deserialize<ReportAllMediaDetailsParams>(json);
var rows = uow.Items.Report_AllMediaDetails(reportParams.profileID, reportParams.organisationID, reportParams.startDate, reportParams.endDate).ToList();
if (rows.Count <= 1)
{
ViewBag.Error = "There were no results for the provided parameters, please adjust the parameters and try again.";
return View("AllMediaDetails");
}