Why is MVC stateless - How to explain?

前端 未结 4 1777
时光说笑
时光说笑 2020-12-19 12:21

While explaining concepts of ASP.NET MVC to my students

MVC is stateless. It is built on top of another stateless protocol - HTTP and HTTPS

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-19 12:42

    MVC is not a protocol is a software architectular pattern.

    On the other hand, HTTP is a protocol.

    In nowadays the MVC pattern is very popular among many web frameworks. These web frameworks and the rest of other web frameworks are used for the development of web applications. In the context of web applications HTTP is an application protocol that is used from browsers for their communication with the servers that host web applications.

    Indeed the nature of HTTP is stateless. There isn't anywhere in HTTP the concept of state. For this reason, in many web frameworks, there are different ways through which we try to implement the concept of state. For instance in ASP.NET Web Forms the ViewState was developed for this reason.

    That being said, MVC has nothing to do with the stateless nature of HTTP.

提交回复
热议问题