Forum Moderators: open
For .Net, it appears to be ASP.NET_SessionId. I have never had a reason to look into this one much, though, so there might be some configuration settings that would change it.
In either case, these should show up in your log files if you have "extended logging" with "cookies" enabled for the website.
There should be a way to loop through all of the cookies with javascript. One of the O'Reilly javascript books has an excellent section on cookies. However, my copy is at home and I am not. I'll check back here tonight to see if you've found a solution. If not, I'll see what I can find in the O'Reilly book. (sorry, I don't recall the title - and it is about 7 years old)
I don't need the session Id itself, I just want to find the cookie created by the Session object.
At any rate, since I posted the previous response, I have realized that I know of another way to get it. But once again, the code sample is at home. I will post it in a few hours.
You can use the ASP script below to fetch any web page. Any cookies from the server will show up amongst the HTTP headers.
Paste the code into a new ASP page and then run it. Enter the URL to a known ASP web page to see the headers returned by the server. (if you run it against a page on the same machine, you may run into permissions and/or dns issues, so pick a remote page)
The headers for an ASP page will include something like this:
Set-Cookie: ASPSESSIONIDCCDQTDAR=LABKDGLAMJPKNGENFPBHMPCK; path=/
The headers for an ASPX page will include something like this:
Set-Cookie: ASP.NET_SessionId=gfqpmpu3mknuoqac3ajk5z45; path=/
Please note that this is an old script. And as written, it utilizes MSXML2.XMLHTTP. You may need to swap in a different component (and modify some code accordingly).
<%@ Language=VBScript %>
<%
Dim objHTTP
Dim sHTML
Dim sHeaders
Dim sResponse
Dim sLocation
Dim sURL
Dim bHeadersOnly
Dim sHeadersCheckedsURL = Request("txtURL")
If Len(sURL) > 0 Then
sURL = Trim(sURL)
Else
sURL = ""
End If
bHeadersOnly = (CLng(Request("chkheadersonly")) = 1)
If bHeadersOnly Then
sHeadersChecked = " checked=""checked"""
Else
sHeadersChecked = ""
End IfIf sURL <> "" Then
If LCase(Left(sURL, 7)) <> "http://" Then
sURL = "http://" & sURL
End If
Set objHTTP = Server.CreateObject("MSXML2.XMLHTTP")
objHTTP.open "GET", sURL, False
objHTTP.send
sHeaders = objHTTP.getAllResponseHeaders
If bHeadersOnly Then
sResponse = ""
Else
sResponse = objHTTP.responseText
End If
Set objHTTP = Nothing
sURL = Mid(sURL, 8)
Else
sResponse = ""
End If
%>
<html>
<head>
<title>Get Page Info</title>
</head>
<body>
<form name="frmUrl" method="POST" action="ServerHeaders2.asp">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>URL to check:</td>
<td> </td>
<td><input type="TEXT" name="txtUrl" value="<%= sURL %>" size="45"></td>
<td> </td>
<td><input type="SUBMIT" value="Get HTML" id=SUBMIT1></td>
</tr>
<tr>
<td colspan="2"></td>
<td align="center"><input type="checkbox" name="chkheadersonly" value="1"<%= sHeadersChecked %>> headers only</td>
</tr>
</table>
</form><hr />
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><strong>HTTP Headers</strong></td>
</tr>
<tr>
<td bgcolor="#dddddd">
<pre><%= Server.HTMLEncode(sHeaders) %></pre>
</td>
</tr>
</table>
<% If Not bHeadersOnly Then %>
<table border="0" cellspacing="0" cellpadding="0">
<tr><td> <br /></td></tr>
<tr>
<td><strong>HTML</strong></td>
</tr>
<tr>
<td bgcolor="#dddddd">
<pre><%= Server.HTMLEncode(sResponse) %></pre>
</td>
</tr>
</table>
<% End If %>
</BODY>
</HTML>