I'm attempting to learn ASP.NET MVC and I've come across some code at our company that uses ViewBag. I've looked into what it is and it just appears to be a container for variables that can be declared in the controller and then accessed from the view.
I've used other frameworks like Ruby on Rails and Struts that don't make me do this. In ruby on rails in particular, I can just call get the variable easily in the view by doing:
<%= variable %>
Further research has led me to believe that using ViewData and ViewBag are not encouraged. Can someone explain the use of it over just getting the variable directly from the controller?
Thanks.