Differenze tra IActionResult, ViewData, ViewBag e TempData in asp.net core mvc

Solitamente in asp.net core mvc nell’ActionResult si ritorna la risposta del controller, mentre si utilizzano ViewBag, ViewData e TempData per passare ulteriori informazioni alla view.

Image for post
Image for post

Introduzione

Image for post
Image for post

IActionResult

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

ViewData

ViewBag

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

TempData

Image for post
Image for post

Conclusioni

Sono uno sviluppatore web full-stack: Angular / TypeScript e ASP.NET MVC CORE C# https://www.stefanomarchisio.it/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store