Reputation: 823
I am using visual studio 2015 and asp.net mvc and I want to initialize a session variable in the Session Start method but im not sure about the signature of the method and i couldn't find documentation about it
Here is what i have as of now in my global.asax file :
public void Session_Start()
{
InscriptionPaiementEntities dbm = new InscriptionPaiementEntities();
var NbreItemMax = dbm.INSC_config.Where(p => p.NomParametre ==
"NbreItemMax").FirstOrDefault();
Session["NbreItemMax"] = NbreItemMax.Texte;
}
Any Help would be gladly appreciated
Upvotes: 5
Views: 16888
Reputation: 5312
Adjust the method signature.
protected void Session_Start(Object sender, EventArgs e)
{
InscriptionPaiementEntities dbm = new InscriptionPaiementEntities();
var NbreItemMax = dbm.INSC_config.Where(p => p.NomParametre ==
"NbreItemMax").FirstOrDefault();
Session["NbreItemMax"] = NbreItemMax.Texte;
}
Upvotes: 8