User guide

Configure the Session State Provider
To configure an ASP.NET application to use DynamoDB as the session state server
1. Add references to both AWSSDK.dll and AWS.SessionProvider.dll to your Visual Studio
ASP.NET project.These assemblies are available by installing the AWS SDK for .NET (p. 4) or
you can install them using NuGet (p. 29).
In earlier versions of the SDK, the functionality for the session state provider was contained in
AWS.Extension.dll. To improve developer usability the functionality was moved to
AWS.SessionProvider.dll. For more information, see the blog post AWS.Extension Renaming.
2. Edit your application's Web.config file: in the system.web element, replace the existing
sessionState element with the following XML fragment:
<sessionState
timeout="20"
mode="Custom"
customProvider="DynamoDBSessionStoreProvider">
<providers>
<add name="DynamoDBSessionStoreProvider"
type="Amazon.SessionProvider.DynamoDBSessionStateStore"
AWSProfileName="profile_name"
Region="us-west-2"
/>
</providers>
</sessionState>
The profile represents the AWS credentials that are used to communicate with DynamoDB to store
and retrieve the session state. If you are using the AWS SDK for .NET and are specifying a profile
in the appSettings section of your application's Web.config file, you do not need to specify a
profile in the providers section; the AWS .NET client code will discover it at run time. For more
information, see Configuring Your AWS SDK for .NET Application (p. 8).
If the web server is running on an Amazon EC2 instance that is configured to use IAM roles for EC2
instances, then you do not need to specify any credentials in the web.config file. In this case, the
AWS .NET client will use the IAM roles credentials. For more information, see IAM Roles for Amazon
EC2 Instances (p. 31) and Security Considerations (p. 42).
Web.config Options
You can use the following configuration attributes in the providers section of your web.config file:
AWSAccessKey
Access key ID to use.This can be set either in the providers section or in the appSettings
section.We recommend not using this setting. Instead, specify credentials by using AWSProfileName
to specify a profile.
AWSSecretKey
Secret key to use.This can be set either in the providers section or in the appSettings section.
We recommend not using this setting. Instead, specify credentials by using AWSProfileName to
specify a profile.
AWSProfileName
The profile name that is associated with the credentials that you want to use. For more information,
see Configuring Your AWS SDK for .NET Application (p. 8).
Version v2.0.0
41
AWS SDK for .NET Developer Guide
Configure the Session State Provider