Lab 3: Using DynamoDB as a Session State Provider

In the DynamoDB service, a table needs to be created. The table is called ‘ASP.NET_SessionState’ and has a primary key called “SessinID” of type string.
001 Create DynamoDB Table

In Visual Studio, the NuGet packages to be managed and the ‘AWS.SDK: Core’, as well as the ‘AWS.SDK for .Net: SessionProvider’ packages need to be installed.
002 NuGet Packages for AWS

In Visual Studio’s web.config window, the ‘<sessionState mode = “Proc…’ section needs to changed to show the following:
003 SessionState in VS web_config.PNG
The keys for Access keys for this section need to be created in AWS, as the created DynamoDB doesn’t automatically have a key attached to it.

In the ShoppingCart.cs window in Visual Studio, the word ‘serializable’ needs to be inserted above the line ‘public class ShoppingCart’ and ‘public class ShoppingCartItem’ as follows:
004 VS ShoppingCart_cs Serializable.PNG

Then in the AWS DynamoDB table, there should be no items present. However, if the DinoStore application is run, and an item is added to the ‘cart’, then the DynamoDB table will update to record the item being sold.

This slideshow requires JavaScript.


The only challenge that I faced with this lab was that I made the incorrect assumption that ‘Sydney’ was a usable alias for the ap-southeast-2 region in ‘Region’ under ‘<Providers>’ in the web.config window in Visual Studio. This would cause the code to break and show the following message:
009 Config Error after Build

Once the ‘Region’ was corrected, the code worked as expected.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s