Added session tracking debug page.

This commit is contained in:
Greg Edwards
2014-09-22 02:26:12 -04:00
parent 5abf851e1e
commit 7bfb1a22db
5 changed files with 101 additions and 0 deletions

View File

@@ -57,6 +57,7 @@
<Reference Include="System.EnterpriseServices" />
</ItemGroup>
<ItemGroup>
<Content Include="Sessions.aspx" />
<Content Include="tetrisds\store.ashx" />
<None Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
@@ -74,6 +75,13 @@
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Sessions.aspx.cs">
<DependentUpon>Sessions.aspx</DependentUpon>
<SubType>ASPXCodeBehind</SubType>
</Compile>
<Compile Include="Sessions.aspx.designer.cs">
<DependentUpon>Sessions.aspx</DependentUpon>
</Compile>
<Compile Include="tetrisds\store.ashx.cs">
<DependentUpon>store.ashx</DependentUpon>
</Compile>

16
Sample/Sessions.aspx Normal file
View File

@@ -0,0 +1,16 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Sessions.aspx.cs" Inherits="Sample.Sessions" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Literal ID="litDebug" runat="server" />
</div>
</form>
</body>
</html>

41
Sample/Sessions.aspx.cs Normal file
View File

@@ -0,0 +1,41 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using GamestatsBase;
namespace Sample
{
public partial class Sessions : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
GamestatsSessionManager gsm = GamestatsSessionManager.FromContext(Context);
StringBuilder builder = new StringBuilder();
builder.Append("Active sessions (");
builder.Append(gsm.Sessions.Count);
builder.Append("):<br />");
foreach (KeyValuePair<String, GamestatsSession> session in gsm.Sessions)
{
builder.Append("Game ID: ");
builder.Append(session.Value.GameId);
builder.Append("<br />PID: ");
builder.Append(session.Value.PID);
builder.Append("<br />Token: ");
builder.Append(session.Value.Token);
builder.Append("<br />Hash: ");
builder.Append(session.Value.Hash);
builder.Append("<br />URL: ");
builder.Append(session.Value.URL);
builder.Append("<br />Expires: ");
builder.Append(session.Value.ExpiryDate);
builder.Append("<br /><br />");
}
litDebug.Text = builder.ToString();
}
}
}

33
Sample/Sessions.aspx.designer.cs generated Normal file
View File

@@ -0,0 +1,33 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Sample {
public partial class Sessions {
/// <summary>
/// form1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
/// <summary>
/// litDebug control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Literal litDebug;
}
}

View File

@@ -23,6 +23,9 @@ namespace Sample.tetrisds
Buffer.BlockCopy(nameBytes, 0, nameChars, 0, nameBytes.Length);
String name = new String(nameChars);
// Since the correct response is actually blank, we don't need to
// write anything to it here.
}
}
}