Since I can't access a session variable in the View, I wonder if I need do add something more to the view to get it to work?
Inside my View:
@Session[ComputerNumber].ToString()
Controller:
Session["ComputerNumber"] = game.RandomNumber();
The error message:
Compiler Error Message: CS0103: The name 'ComputerNumber' does not exist in the current context
You can use
Session
in the view, you just need to use string indexer, just like in your controller. In your caseComputerNumber
is not a string, it is a variable which does not exist. Changeto
and it should all be working