The WebViewPage in an abstract class that inherits from the WebViewPage<TModel> generic abstract class.
Two properties of the WebViewPage<TModel> generic abstract class are:
- Model (dynamic)
- ViewData (key/value collection)
Among other properties, the WebViewPage adds:
- ViewBag (dynamic)
The ViewBag property is another way to get to the ViewData data.
If in the controller you did the following:
ViewData["website"] = "guyellisrocks.com";
ViewData["somenumbers"] = Enumerable.Range(0, 10);
Then in the view you could access that data through the ViewBag:
@foreach (int i in ViewBag.somenumbers)
and this would emit to the web page: