Jacqui1811
Programmer
Hi Guys.
BTW if in the wrong area let me know I was not sure if it should be c# or .net area but as I am convinced it is the .net framework I am having trouble with rather than the syntax.
I have been doing asp for years fine and dandy but have now decided to try and move to asp.net.
I am trying to create a .cs file and assign an object to a session object.
When I try and compile the code using nant I get the following error "The name 'Session' does not exist in the class or namespace"
I realise that I am probabley doing something really stupid but I can not see what it is.
Here is the code for the method where I assign the game object to the variable and also my using directives so you can see what I am referencing:
using System ;
using BeadGame.Storage ;
using System.Collections ;
using System.IO ;
using System.Web ;
using System.Web.SessionState ;
// This will get the current game details
public static Game CurrentGame(IDataAccess sda)
{
string sqlStatement = "select game_ref from game where current = 'y' " ;
// execute the sql statement
IList GameIDs = sda.ExecSql(sqlStatement) ;
Hashtable ht = GameIDs[0] as Hashtable ;
int GameID = Convert.ToInt32(ht["game_ref"]) ;
GameDataManager dm = new GameDataManager() ;
IList ruleList = dm.GameRules(GameID);
Hashtable beads = dm.CurrentBeads(GameID) ;
Bag bag = new Bag(beads) ;
DateTime startDate = dm.GameStartDate(GameID) ;
Game myGame = new Game(GameID, ruleList, bag, startDate) ;
// Here we assign the current game object to the session game variable
Session[myGame] = myGame ;
return myGame ;
}// end
I am sure it is only me but I have even tried just assigning a string to the Session variable but get the same response.
Realy hope you can help, you normally do.
Thanks.
Jacqui
BTW if in the wrong area let me know I was not sure if it should be c# or .net area but as I am convinced it is the .net framework I am having trouble with rather than the syntax.
I have been doing asp for years fine and dandy but have now decided to try and move to asp.net.
I am trying to create a .cs file and assign an object to a session object.
When I try and compile the code using nant I get the following error "The name 'Session' does not exist in the class or namespace"
I realise that I am probabley doing something really stupid but I can not see what it is.
Here is the code for the method where I assign the game object to the variable and also my using directives so you can see what I am referencing:
using System ;
using BeadGame.Storage ;
using System.Collections ;
using System.IO ;
using System.Web ;
using System.Web.SessionState ;
// This will get the current game details
public static Game CurrentGame(IDataAccess sda)
{
string sqlStatement = "select game_ref from game where current = 'y' " ;
// execute the sql statement
IList GameIDs = sda.ExecSql(sqlStatement) ;
Hashtable ht = GameIDs[0] as Hashtable ;
int GameID = Convert.ToInt32(ht["game_ref"]) ;
GameDataManager dm = new GameDataManager() ;
IList ruleList = dm.GameRules(GameID);
Hashtable beads = dm.CurrentBeads(GameID) ;
Bag bag = new Bag(beads) ;
DateTime startDate = dm.GameStartDate(GameID) ;
Game myGame = new Game(GameID, ruleList, bag, startDate) ;
// Here we assign the current game object to the session game variable
Session[myGame] = myGame ;
return myGame ;
}// end
I am sure it is only me but I have even tried just assigning a string to the Session variable but get the same response.
Realy hope you can help, you normally do.
Thanks.
Jacqui