Web
Analytics
ViewData, ViewBag, TempData and Session Example in asp.net MVC | Angular | ASP.NET Tutorials

For Consultation : +91 9887575540

Stay Connected :

  1. Data Passing techniques from a controller to View.
    View Data and View Bag are Data Dictionary objects.
    ViewData: View Data is accessible using string key value and need typecasting.
    ViewBag: Dynamic type property, Doesn’t require typecasting
    TempData: TempData is a dictionary object that is derived from TempDataDictionary class
    TempData is used to pass data from current request to subsequent request
    Session:
    derived from HttpSessionState class
    Session is valid for all requests, not for a single
    redirect

 

Download Source Code