I have a web application written in asp.net mvc2. Currently hosted on amazon cloud ec2. Because of growing traffic we want move multi instance enviorenment. I have a custom session class which currently initiate at session start (global asax) and i am using via getter or setter class in application. Because of multi instance chore i have to handle hole security architecture. I am looking a better way to handle this problem.
protected void OnSessionStart()
{
HttpContext.Current.Session.Add("mySessionObject", new MyAppSession());
}
public static MyAppSession GetMySessionObject(HttpContextBase current)
{
if (current != null)
{
if (current.Session != null)
if (current.Session["mySessionObject"] == null)
{
current.Session.Add("mySessionObject", new MyAppSession());
}
}
if ( current != null && current.Session != null)
return (MyAppSession ) (current.Session["mySessionObject"]);
return null;
}
and so on.
There is wide options for session management on multiinstance enviorenment.
I choose second one.