ASP.NET Session State Using an Amazon DynamoDB Session Store

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

If you don't want to use SQL server you can use Amazon's hosted Dynamo DB nosql database as a session store.

You'll need the AWS SDK. To install this from the Visual Studio nuget package manager console use the following command

Install-Package AWSSDK 

You can then configure your sessionState provider to use a custom provider. You must specify the region and credentials, either a profile or an IAM access and secret key combination. By default this will create a table named ASP.NET_SessionState.

<configuration>
  <system.web>
    <sessionState
      timeout="20"
      mode="Custom"
      customProvider="DynamoDBSessionStoreProvider">
      <providers>
        <add name="DynamoDBSessionStoreProvider"
             type="Amazon.SessionProvider.DynamoDBSessionStateStore"
             AWSProfileName="[PROFILE]"
             Region="[REGION]"
             CreateIfNotExist="true"
             />
      </providers>
    </sessionState>
  </system.web>
</configuration>


Got any ASP.NET Question?