I have below code at my ASP.NET 4.0 web application's Global.asax
protected void Application_Start(object sender, EventArgs e)
{
Dictionary<string, string> AllCompanyList = new Dictionary<string, string>();
Application.Add("GlobalCompanyList", AllCompanyList);
Thread ProcessCompanyThread = new Thread(new ParameterizedThreadStart(CompanyThread.Start));
ProcessCompanyThread.IsBackground = true;
ProcessCompanyThread.Start(AllCompanyList);
}
I access it on another page by
Dictionary<string, string> AllCompanyList = (Dictionary<string, string>)HttpContext.Current.Application["GlobalCompanyList"];
First of all, is "GlobalCompanyList" only has one instance in IIS's lifetime?
Second, is "GlobalCompanyList" thread safe to be access or modify in ProcessCompanyThread? If it is not then what must i do to make it thread safe?
Thanks for help.