0

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?

1

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

2 Comments

OK, in detail, is the controller instance in a new thread? app domain? or process? and is there limitation defined by ASP.NET MVC or IIS that controlling the number of controller instances? Thanks.
It is invoked in one of the IIS threadpool threads. But why are you asking? What do you want to achieve?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.