1

In old legacy project we have a lot of code like this:

var result = someService.AddRecord(data);
TempData["Success"] = result.Success;
TempData["Message"] = result.Message;
return RedirectToAction("Rakamakafo");

But then we faced the situation when requests processed serial in controller, which caused by locking nature of Session object and solved this by turning Session to read-only:

[SessionState(System.Web.SessionState.SessionStateBehavior.ReadOnly)]

It's all good except TempData object (which relies on session) stopped working.

How this can be solved in clean way without rewriting whole application to AJAX?

Troll the Legacy
  • 675
  • 2
  • 7
  • 22

1 Answers1

0

Done it using cookies. First, I'd created BaseController with ShowMessageAfterRedirect(bool success, string message) and set two cookies (message_success and message_caption), then in message displaying partial view I'm taking data back from cookies and deleting them.

Troll the Legacy
  • 675
  • 2
  • 7
  • 22