Using system;
Using system. Data;
Using system. configuration;
Using system. Web;
Using system. Web. Security;
Using system. Web. UI;
Using system. Web. UI. webcontrols;
Using system. Web. UI. webcontrols. webparts;
Using system. Web. UI. htmlcontrols;
Public partial class _ default: system. Web. UI. Page
{
Protected void page_load (Object sender, eventargs E)
{
If (! This. Page. ispostback)
{
Session ["name"] = "1 ";
Session ["name1"] = "2 ";
Session ["name2"] = "3 ";
}
}
Protected void button#click (Object sender, eventargs E)
{
String [] A = new string [session. Keys. Count];
For (INT I = 0; I <session. Keys. Count; I ++)
{
A [I] = session [I]. tostring ();
}
Response. Write (A. length. tostring ());
}
}
This is my background code. I have obtained the number of sessions and the retrieved values are also too lazy to write. They are all in the string array.
Some people will ask if this will load the server too much, but we can give the processed string array to a global string array.
In this way, you can click it once every several tens of seconds. Then, when the user makes statistics, the global string array won't be enough. How many resources can a string array waste ?!
Do you have any good ideas about 'wating...