Why is MVC stateless - How to explain?

前端 未结 4 1776
时光说笑
时光说笑 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:54

    The assertion in the question, purported by the other student it wrong. A stateless protocol like HTTP sure does care if it gets (or never gets) a response!

    [A stateless protocol] treats each request as an independent transaction that is unrelated to any previous request so that the communication consists of independent pairs of request and response.

    Of course, MVC isn't even a protocol .. but the same notion can be extended. It is "stateless" insofar as all the information is encoded in the request and response as a "pair". In practice, most usages are not truly stateless.

提交回复
热议问题