Asp.net MVC uses stateless protocol, if yes then how is the session gets sustained? to explain it in a better manner. I have two methods like this
public class HomeController : Controller
{
// GET: Home
public ActionResult Index()
{
HttpContext.Session["somename"] = "foo";
return View();
}
public ActionResult SomeMoreIndex()
{
var name = (string)HttpContext.Session["somename"];
return View("Index");
}
}
- now, when i make a request home/index and check the sessionId using
HttpContext.Session.SessionID
i get this id "wfeprxbpbngr4jn24n1dttg1" but when i make a same request i get some other session id like this "oaxw3g4f5felo2nr0ly15dn4"
- as you can see i am storing some value in the session named "somename". now when i try to acess the session, i get the value which i have store in the method named Index even tough i get a different session Id for every request.
how is it possible?