开发者

ASP.NET session mixing

We have our ASP.NET sessions persisted to a central SQL server. So now all session data is forced to travel 开发者_C百科over the wire to an SQL server, even if it's just trivial information. Can I mix sessions --- ie. Keep SQL for session["abc"] = "value" and have an overwrite to store stuff locally, such as session.AddLocalMemory["xyz"] = "blah".


Not with any of the built-in providers. You could add an extension method to HttpSession and use it to store stuff locally. This could be done by simply inserting a state bag into ASP .NET memory cache with a timeout.

If this is a load balanced environment (involving more than one web server), you should consider the consequences of different requests going to different servers, and use local storage accordingly.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜