Barış Velioğlu
Barış Velioğlu

Reputation: 5817

Directly reaching SessionId from the .aspx page

When I tried to get the SessionId of the user session in aspx page like below, it returns nothing

default.aspx

Session ID : <% Session.SessionID.ToString(); %>

but if I use a literal and try to assign sessionId to it in the page_load, it works. So which lifecycle step that aspx page is being loaded to the page ? Why this happening ?

Thanks,

Upvotes: 2

Views: 95

Answers (1)

Steve Wellens
Steve Wellens

Reputation: 20620

Try this (note the equal sign and no semicolon):

Session ID : <%= Session.SessionID.ToString() %>

...and this list of server tags will help you in the future:

http://forums.asp.net/p/1139381/1828702.aspx#1828702

Upvotes: 3

Related Questions