How to print out all the variables in the Session

Platform: ASP.NET| Category: Session

VB.NET


Dim strKey as string
For Each strKey In Session.Keys
Response.Write(strKey + ' : ' + Session(strKey).ToString() + '<br>')
Next

C#


foreach (string strKey in Session.Keys) 
{ 
Response.Write(strKey + ' : ' + Session[strKey].ToString() + '<br>'); 
}  

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.