Session are private to the user.
Cache are global to the application.
Sessions may change from user to user whereas a single
Cache will be maintained for the entire application.
The following code shows how you can declare Session and Cache.
Session["MySession"] = TextBox1.Text;// Here Session is declared.
Cache.Insert("MyCache", TextBox2.Text);// Here Cache is declared.
Regards,
Asked In: Many Interviews |
Alert Moderator