Event in Global.asax file that fires only for once
Posted
by
fiberOptics
on Stack Overflow
See other posts from Stack Overflow
or by fiberOptics
Published on 2012-10-03T09:35:52Z
Indexed on
2012/10/03
9:37 UTC
Read the original article
Hit count: 185
In MVC Global.asax file, we can see the Application_Start
where this event fires only for once. But the session is not yet active/available here. So my question is, is there any event in Global.asax file that fired only for once and session is available also?
The reason I ask this is because, I use ExpandoObject
e.g.:
public static dynamic Data
{
get
{
#region FAILSAFE
if (HttpContext.Current.Session[datakey] == null)
{
HttpContext.Current.Session[datakey] = new ExpandoObject();
}
#endregion
return (ExpandoObject)HttpContext.Current.Session[datakey];
}
}
I want to initialize all of my ExpandoObject at once with the value of null:
MyExpando.Data.UserInformation = null;
MyExpando.Data.FolderInformation = null;
That's why I'm looking for an event that only fired once.
© Stack Overflow or respective owner