Skip to main content

Why the "Your session has expired" Error Might Occur

  • 3 minutes to read

This topic explains what causes the “Your session has expired” error and how to resolve it.

Use the chart below to determine the possible reason for the error in your application.

Deployment-servererror

The document’s state is stored on another server

This problem occurs when you use RichEdit or Spreadsheet in a stateless environment (Cloud, Web Farm, Web Garden) without a custom state provider.

A server loads a document to RAM and then opens the document when it receives a request. If additional requests are sent to another server that does not contain the document’s state in its RAM, the “Your session has expired” error occurs.

Solutions

Use a custom state provider

A document state provider allows you to store an opened document’s state in external storage. Web servers check out the requested documents from storage, process them, and return the latest document states. Web servers do not store server-specific states between requests.

We published two ready-to-use state providers for Redis and SQL data stores. You can find source code for these providers (with sample applications) in the following GitHub example:

View Example: aspnet-office-solutions

Use session affinity mode

In session affinity mode, a document’s state is stored in the RAM of the server where the document is opened. All document requests are redirected to this server.

To see an example, refer to the following GitHub solution:

View Example: Azure-SessionAffinity-Starter

You can also use this approach with a different cloud platform.

See the following DevExpress ASP.NET team blog post for more information: Scalability of ASP.NET Office Controls - Azure, Web Gardens, Farms, & Cloud Support.

The CloseDocument or CloseAllDocuments method is called

If multiple users work on a document, the “Your session has expired” error can occur when a user’s actions call the CloseAllDocuments() method or if the CloseDocument(String) method is called with the wrong parameter value.

Solution

The dispose timeout for hibernated documents expired

When document hibernation is enabled (EnableHibernation), the DocumentManager hibernates inactive open documents after an idle timeout (HibernateTimeout) period has passed. The HibernatedDocumentsDisposeTimeout property specifies how long hibernated documents are stored on the server before disposal. If a user attempts to access a disposed document, the “Your session has expired” error occurs.

Solution

Increase the value of the HibernatedDocumentsDisposeTimeout property. (The default value is 24 hours.)

Idle timeout for an application pool expired

In a stateful environment, a worker process shuts down when the idle timeout period for an application pool expires.

Solution

Increase the Idle Time-out value (20 minutes by default) or set the Idle Time-out to 0 (zero) to disable the timeout.

Application pool is recycled

IIS restarts worker processes that handle requests for application pools.

Solution

Check the application pool recycle settings and increase the Regular Time Interval value.

Other reasons

If none of the above solutions help, contact our Support Center and provide a sample project, a test document, and a video that shows the steps to reproduce this message.