How to check all the keys from Session?

 Posted by vishalneeraj-24503 on 12/27/2013 | Category: ASP.NET Interview questions | Views: 2598 | Points: 40
Answer:

With the help of Session.Keys property,
we can get all the keys.

For Example:-

Session["Name"] = "Vishal";

Session["Phone_No"] = "123455667";

foreach (string key in Session.Keys)
{
Response.Write(key + "<br/>");
}


It will return:Name and Phone_No


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response