Write to Application array in Application_Start?

  • Thread starter Thread starter Randall Parker
  • Start date Start date
R

Randall Parker

Can one use the Application array (or list or whatever it is) and set a field of
one's own in Application_Start() and then read out that field in a page's Page_Load()
event?

Or is Application just for ASP.Net's own settings field names?
 
Application.Add("SomeKey", anyVariable);

anyVariable is of type object, so it can be an array or whatever.

It should be noted that it'll be shared amongst all request and you should
be careful about writing into it after Application_Start, but you can easily
read the value in page load:

string[] x = (string[])Application["SomeKey"];

Hope that's what you meant.

Karl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top