A series of beginning and end actions. Data Privacy, session termination, resource release, and memory saving for accessors
Easy to lose and difficult to determine the timeout
Session ["key name"] = Value
Cookie is a small amount of text data stored on the client by the website.
Advantage: 8 K of data can be stored theoretically, and the validity period can be customized, which does not occupy disk space on the server and provides better stability.
Disadvantages: easy to lose and poor security
C # code for writing data to cookies:
Response. Cookies ["userlgin"]. value = "tom ";
C # code for reading client Cookie data:
String uName = Request. Cookie ["userName"];
Application
Cache
Xml
File
Database
VieWState
// Use the ViewState object to save the value. The valid range of this object is that the current page can be accessed. It is stored on the client. Send back each time
// ViewState is the StateBag class. The data types that can be stored include int bool string or array and its basic data types, and arraylist, hashtable,
// Or a type with a type converter that can be serialized
Public string Text
{
Get
{
If (ViewState ["value"] = null)
{
Return String. Empty;
}
Return (string) ViewState ["value"];
}
Set
{
ViewState ["value"] = value;
}
}
Aspnetdb database profile personalized configuration member qualification and role management
Request. Tranfer ()
Using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. Web;
Using System. Web. UI;
Using System. Web. UI. WebControls;
Using System. Web. Security;
Using BLL;
Using System. Data;
Public partial class User_Question_Default: System. Web. UI. Page
{
Public int num = 9;
Private string name = "sa ";
Public string Name
{
Get {return name ;}
Set {name = value ;}
}
Private string email = "@ 263 ";
Public string Email
{
Get {return email ;}
Set {email = value ;}
}
Protected void Page_Load (object sender, EventArgs e)
{
}
Protected void button#click (object sender, EventArgs e)
{
Context. Server. Transfer ("Default2.aspx", true );
}
}
Target page:
Using System;
Using System. Collections. Generic;
Using System. Linq;
Using System. Web;
Using System. Web. UI;
Using System. Web. UI. WebControls;
Public partial class User_Question_Default2: System. Web. UI. Page
{
Protected void Page_Load (object sender, EventArgs e)
{
User_Question_Default ud = (User_Question_Default) Context. Handler; // an error is reported and the running is not affected,
Response. Write (ud. Name. ToString ());
// Response. Write (Request. Form ["TextBox1"]. ToString (); // get a class object, which can be freely operated
}
}