If I do something as follows:
public ActionResult Login(String Username,String ClientCode)
{
HttpContext.Session["clientcode"] = ClientCode;
HttpContext.Session["security"] = Repository.GetSomething(HttpContext.Session["clientcode"].ToString());
}
Is HttpContext.Session[“clientcode]”.ToString() garuanteed to return the value that was just passed in or does it have similar behavior to cookie where this would be unacceptable as the cookie is not garuanteed to still be there even a split second after setting it?
the value will be lost as soon as the AppDomain resets or the user session times out. so, in theory, you have no guarantee.
but why would you not wanna use “ClientCode” in the second line of your example?