Asp.net-mvc: calling Session_Start in global.asax
I am using visual studio 2015 and asp.net mvc and I want to initialize a session variable in the session start method, but I am not sure about the method signature and I could not find any documentation on this
This is what I currently have in the 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
+3
source to share
1 answer
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;
}
+2
source to share