2

I need your help to sort out one problem with session timeout in my application which are hosted on Azure platform.

I have developed web application in asp.net and make login functionality with session and put following code maintain timeout period for session like

<sessionState mode="InProc" timeout="20"></sessionState>

It working fine on local system but when i will tested it with live URL on Azure platform it will signout frequently (session expired).

Can any one please suggest me how can i resolve this issues?

Thanks Arun.

Jamie Hutton
  • 260
  • 3
  • 13
Arun Rana
  • 8,426
  • 14
  • 67
  • 107

2 Answers2

4

Are you running more than one WebRole instance? Remember, "InProc" session-state will not be shared across multiple web-role instances. In fact, InProc session state is "evil" in the cloud world, will not work for any deployments with more than 1 instance running. You really want to use another provider, like Session provider for AppFabric Cache

Igorek
  • 15,716
  • 3
  • 54
  • 92
  • hi Igorek , yes my web application running on 5 instance right now , I have also tested it with one instance and as per you have told it is wroking fine so can you please suggest me or give me some link to sort out this issues on multiple instances. – Arun Rana Sep 07 '11 at 06:11
  • 2
    Igorek's link 404s now, this link helped me when trying to configure session state using Azure Caching: http://msdn.microsoft.com/en-us/library/windowsazure/gg185668.aspx – David Ipsen Apr 23 '13 at 13:18
1

Are you sure the session is expiring? If you are using ASP.NET forms authentication there is another timeout to consider (here I have set it to 180 mins)

<authentication mode="Forms">
  <forms loginUrl="Login/" timeout="180"/>
</authentication>

If you do have multiple instances Igorek is right - the session will not be shared.

Please see how-does-microsoft-azure-handle-session-state/1023125#1023125 or refer to the Azure SDK for more information.

Community
  • 1
  • 1
Neil Thompson
  • 6,356
  • 2
  • 30
  • 53