1.Client Side Context Usage
For Callout: While working with callouts, you can get context as first parameter of callout function.
...
VIS.Env.getCtx().setContext("key",value);
2.Server Side Context Usage
...
For custom controllers
Ctx vCtx = Session["ctx"] as Ctx;
...