I have read many articles and documentation and still its not clear to me what i can include in the global.asax and _AppStart.cshtml files.
I tried putting simple things like
@{
var rlist = new List<string>();
rlist.Add("Value1");
rlist.Add("Value2");
}
in both of the files and tried to use them in my Default.cshtml with no luck..it says its not defined in the context.
I thought that this code would be recognizable everywhere.
The only way i have found that it works ONLY for _AppStart.cshtml is by assigning my var to AppState dictionary:
@{
var rlist = new List<string>();
rlist.Add("Value1");
rlist.Add("Value2");
AppState["rlist"] = rlist;
}
Then i can reference through my pages the rlist variable by something like this:
var soulis = ((List<string>) AppState["rlist"]);
In Global.asax the above doesn't work..
Can someone explain what is happening?