Displaying the all the name-value pairs of the session object?

G

Guest

Hello All,

I want to display all the name-value pairs of the session object....how can
I print them out? i.e., suppose once a user logs in I set a session variable
login time Session["logintime"] = "2pm" and Session["logouttime"]="10pm". So
how can I print these variables i.e., logintime and logouttime and their
values together?

In which namespace is the Session object...can I retrieve the name-value
pairs as collection?

Thanks for your help!!
 
J

Juan T. Llibre

<%@ Page Language="VB" %>
<html>
<head>
</head>
<body>
<script language="VB" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
Dim Item as String
For Each Item In Session.Contents
Response.Write (Item & " = " & Session(Item))
Response.Write ("<br>")
Next
End Sub
</script>
</body>
</html>
 
G

Guest

I was looking for an ASP.NET API.

Juan T. Llibre said:
<%@ Page Language="VB" %>
<html>
<head>
</head>
<body>
<script language="VB" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
Dim Item as String
For Each Item In Session.Contents
Response.Write (Item & " = " & Session(Item))
Response.Write ("<br>")
Next
End Sub
</script>
</body>
</html>






Diffident said:
Hello All,

I want to display all the name-value pairs of the session object....how can
I print them out? i.e., suppose once a user logs in I set a session variable
login time Session["logintime"] = "2pm" and Session["logouttime"]="10pm". So
how can I print these variables i.e., logintime and logouttime and their
values together?

In which namespace is the Session object...can I retrieve the name-value
pairs as collection?

Thanks for your help!!
 
J

Juan T. Llibre

heh, heh...

You should have said so.

The Session object is in the
System.Web.SessionState.HttpSessionState class :

http://www.csharpfriends.com/quicks...ystem.Web.SessionState&class=HttpSessionState

I don't think you can access the Session collections
for all users of an application unless you log the items
to a database, though.

If you find a way, please post the solution.





Diffident said:
I was looking for an ASP.NET API.
Juan T. Llibre said:
<%@ Page Language="VB" %>
<html>
<head>
</head>
<body>
<script language="VB" runat="server">
Sub Page_Load(Sender As Object, E As EventArgs)
Dim Item as String
For Each Item In Session.Contents
Response.Write (Item & " = " & Session(Item))
Response.Write ("<br>")
Next
End Sub
</script>
</body>
</html>




Diffident said:
Hello All,

I want to display all the name-value pairs of the session object....how can
I print them out? i.e., suppose once a user logs in I set a session variable
login time Session["logintime"] = "2pm" and Session["logouttime"]="10pm". So
how can I print these variables i.e., logintime and logouttime and their
values together?

In which namespace is the Session object...can I retrieve the name-value
pairs as collection?

Thanks for your help!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top