I working on MVC project compatible with OWIN Middleware pipeline.
In Action of the controller i want to store some objects for some reson inside the Environment object so i do some thing like that:
Request.GetOwinContext().Environment["loginViewModel"] = model;
Request.GetOwinContext().Environment["signInMessage"] = message;
When i try to get this keys from another controller's action i found that the Environment object is not contains this keys so what is the wrong?
I think i figure out the solution,
Environment object is related to the current request so each request has it's own environment, there are a standard OWIN Environment keys that should populate the Environment dictionary every time the request is coming and if i want to add to this environment request i should add this for each request for example using middleware. so i used session instead to store this objects.