Click here to Skip to main content
13,356,318 members (67,723 online)
Rate this:
Please Sign up or sign in to vote.
See more:

I had read that MVC is stateless.
Now i found the meaning of stateless that, If the user requests the same page again, the server repeats the entire sequence, reprocessing the page from scratch. Put another way, a server has no memory of pages that it has processed—page are stateless. Therefore, if an application needs to maintain information about a page.

but still i am confused. Not getting idea.
If MVC is stateless then session variable is not available in MVC?
Or session variable and stateless is different?

Posted 8-Jan-13 2:07am
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

MVC is stateless because HTTP is. There is nothing in HTTP that indicates when a session starts or ends.

[Moved From 2nd answer]
They are stateless in the sense that you can never know when the user stops using your site or that the session is lost if the browser fails to transport your state parameters. Compare with FTP or IRC. They have built in session support. Try maintaining state without cookies. It's possible but ugly (the user can just remove any query string parameter or the viewstate from the POST). It's still valid HTTP, but the session will be lost
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Http is stateless by definition.
Even if classic claims to be statefull, it is simulating state by storing some state information and sending it from client to server and back. Actually the IIS + ASP.NET processing pipeline is more complicated to declare it statefull or stateless, since there are application objects that persist between several calls. But this is highly configurable and depends on many things.

Session is of course there in MVC also, and that's the primary storage of volatile data to be passed between calls, that we don't want to persist.

Believe me, the MVC approach is the canonical one, the ASP.NET classic approach was an interesting but very unique approach.

If you want to get an insight in ASP.NET pipeline check this article:[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.180111.1 | Last Updated 9 Jan 2013
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100