Your application may be running in multiple Microsoft Azure regions actively and serving regional traffic with location affinity. In this scenario, you may occasionally need to redirect some or all of the traffic to another location either to handle overflow or disaster recovery. But, when this happens, you donít want your users to lose their ASP.NET Sessions if their request is routed to a different Microsoft Azure region.
To handle these situations, NCache provides an intelligent multi-site ASP.NET Session support for Microsoft Azure. This allows your ASP.NET application to share ASP.NET Sessions across the WAN seamlessly but without replicating the sessions which has significant bandwidth cost associated with it.
NCache achieves this by letting you define one primary and multiple secondary ASP.NET Session State caches in your ASP.NET web.config. All ASP.NET sessions are originally stored in their primary cache.
<configSections> <section name="ncache" type="Alachisoft.NCache.Web.SessionStateManagement.NCacheSection, Alachisoft.NCache.SessionStateManagement, Version=x.x.x.x, Culture=neutral, PublicKeyToken=CFF5926ED6A53769"/> </configSections> <ncache> <sessionLocation> <primaryCache id="London_Cache" sid-prefix = "LDC"/> <secondaryCache id="NewYork_Cache" sid-prefix="NYC"/> <secondaryCache id="Tokyo_Cache" sid-prefix="TKC"/> </sessionLocation> </ncache>
However, when a request gets routed to another location, NCache Session State Provider (SSP) intelligently detects that the session for this user resides in one of the other locations and automatically moves it from there to this new location. Then, this userís request can be served from this new location from this point onward. This allows the user to seamlessly continue using your application.