Shuping
Shuping

Reputation: 5468

How does ASP.NET MVC create controller instances

How does ASP.NET MVC create controller instances for request? does it create different instances for different requests? if that so, does it mean ViewBag cannot be shared between actions in a controller although it is a member in controller?

Upvotes: 0

Views: 604

Answers (1)

Dennis Traub
Dennis Traub

Reputation: 51654

Every request invokes its own controller instance. Therefore the ViewBag is local to every single request as well.

Upvotes: 1

Related Questions