亚马逊ec2上的ASP.NET MVC多实例会话管理
我有一个用 ASP.NET MVC2 编写的 Web 应用程序。目前托管在亚马逊云ec2上。由于流量不断增长,我们希望移动多实例环境。我有一个自定义会话类,当前在会话启动时启动(全局 asax),并且我通过应用程序中的 getter 或 setter 类使用。由于多实例杂务,我必须处理漏洞安全架构。我正在寻找更好的方法来处理这个问题。
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.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
多实例环境上的会话管理有多种选择。
我选择第二个。
There is wide options for session management on multiinstance enviorenment.
I choose second one.