ApplicationStatus Management
Application ["Number"] = 0;
Application ["Number"] = (INT) application ["Number"] + 1;
SessionStatus Management
This. label2.text = session ["who"]. tostring ();
Session ["who"] = This. textbox1.text;
Application And Session Differences: Application Pass the data that applies to all pages, Session Transmits data suitable for a specific connection.
Status information is stored outside the process
1), Saved on the Status Server
<Sessionstate mode = "StateServer"Stateconnectionstring = "TCPIP = 127.0.0.1: 42424"Cookieless = "false"
Timeout = "20"/>
</Sessionstate>
2), Stored in the database
<Sessionstate mode = "sqlserver"
Sqlconnectionstring = "Data Source = (local); User ID = sa; Password ="/>
Cookie
//DefinitionCookie, Set its value
Httpcookie objcookie = new
Httpcookie ("mycookie ");
Objcookie. Values. Add ("backcolor ",
"Blue ");
Objcookie. expires =
Datetime. Now. addhours (1 );
Response. Cookies. Add (objcookie );
//UseCookie
Httpcookie objcookie =
Request. Cookies ["mycookie"];
Button1.backcolor = system. Drawing. color. fromname (objcookie. Values ["backcolor"]);