Search code examples
c#asp.net-mvc-3sizelimittempdata

What is the maximum amount of data that should be placed in TempData?


Is there a cap or best practice with regards to how much data should be placed in the TempData dictionary?


Solution

  • Check this post that describes best practices when using TempData:

    When to use ViewBag, ViewData, or TempData in ASP.NET MVC 3 applications

    This one goes even further:

    ASP.NET MVC: Do You Know Where Your TempData Is?

    Bottom line is: By default, TempData is stored in the Session object. So the limit is the limit of your Session object. See this post for some insight.

    Things to consider:

    • Generally, Session is stored in workerprocess memory eg.: in RAM....
    • To increase the amount of available memory, check the memory limit of your Application Pool in IIS.

    For a more in-depth view of the Session object, check this doc at MSDN:

    ASP.NET Session State Overview