.NET and ASP.NET interview question - Difference between Cache and Session?

 Posted by ArticlesMaint on 4/12/2011 | Category: ASP.NET Interview questions | Views: 5772

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.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response