AWS SDK for .NET Documentation
Amazon.SessionProvider Namespace
AmazonAmazon.SessionProvider Did this page help you?   Yes   No    Tell us about it...
 
Declaration Syntax
C#
namespace Amazon.SessionProvider
Types
All TypesClasses
IconTypeDescription
DynamoDBSessionStateStore
DynamoDBSessionStateStore is a custom session state provider that can be used inside of an ASP.NET application. Session state is saved inside a DynamoDB table that can be configured in the web.config. If the table does not exist the provider will create it during initialization with default read and write units set to 10 and 5 unless configured otherwise. If the table is created the application startup will block for about a minute while the table is being created. Example web.config entry setting up the session state provider.
CopyC#
<sessionState 
  mode="Custom" 
  customProvider="DynamoDBSessionStoreProvider"gt;
  <providers>
    <add name="DynamoDBSessionStoreProvider" 
         type="Amazon.SessionProvider.DynamoDBSessionStateStore"
         AWSAccessKey="YOUR_ACCESS_KEY"
         AWSSecretKey="YOUR_SECRET_KEY"
         Region="us-east-1"
         Table="ASP.NET_SessionState"
         />
  </providers>
</sessionState>

The schema for the table used to store session requires a string hash key with no range key. The provider will look up the name of the hash key during initialization so any name can be given for the hash key.

Below is a list of configuration attributes that can specified in the provider element in the web.config.
Config ConstantUse
AWSAccessKey
Access key used. This can be set at either the provider or in the appSettings.
AWSSecretKey
Secret key used. This can be set at either the provider or in the appSettings.
Region
Required string attribute. The region to use DynamoDB in. The default is us-east-1. Possible values are us-east-1, us-west-1, us-west-2, eu-west-1, ap-northeast-1, ap-southeast-1.
Application
Optional string attribute. Application is used to partition the session data in the table so it can be used for more than one application.
Table
Optional string attribute. The table used to store session data. The default is ASP.NET_SessionState.
ReadCapacityUnits
Optional int attribute. The read capacity units if the table is created. The default is 10.
WriteCapacityUnits
Optional int attribute. The write capacity units if the table is created. The default is 5.
CreateIfNotExist
Optional boolean attribute. CreateIfNotExist controls whether the table will be auto created if it doesn't exist. Default is true.