So I basically have an event that fired off when my connected cash receiver takes in money, and I'm using a session variable to store the index of the bill inserted, and I get an error that says: 
My session variables work everywhere else correctly except here. Any idea why this is happening? Everywhere I look online it tells me to set up my session correctly which it is if my other ones work fine. This event is fired when on a view page with no other methods running. Any help is appreciated. If the information is too vague I apologize, I will provide more information if you need it to help me solve this problem. Thank you.
This is the event being fired where the SetString is causing the error.
void validator_OnCredit(object sender, CreditArgs e)
{
Console.WriteLine("Credited bill#: {0}", e.Index);
switch (e.Index)
{
case 1:
HttpContext.Session.SetString("Test", "1");
break;
default:
HttpContext.Session.SetString("Test", e.Index.ToString());
break;
}
Thread.Sleep(500);
}
