1, contrast.
Project ------------------------ Session --------- ViewState User Server Resources ----------- True ------------ Falsetime Out -------------------- True ------------ False stores any .NET type ----------- True ---------- False (only support Strings, Integers, Booleans, Arrays, ArrayList, Hashtable, Custom Typeconverters) increase HTML Load ---------------- False ---------- True
2, session is valid for the entire Application, and the viewState is equivalent to the session of a page; 3, definition
ViewState: // Save in ViewState ViewState ["Sortorder"] = "DESC"; // read from viewstate string sortorder = (string) ViewState ["Sortorder"];
Session: //