-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBrowserSession.cs
More file actions
45 lines (39 loc) · 1.34 KB
/
Copy pathBrowserSession.cs
File metadata and controls
45 lines (39 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Collections.Generic;
using System.Web;
using Microsoft.JScript;
using JSON_ns;
namespace ARI_POC
{
/// <summary>
/// Manage session information.
/// </summary>
/// <remarks>
/// A proper design would keep all session information either in the browser (in the form of
/// cookies and URLs) or in the database. This makes load balancing and server redundancy
/// much more robust. This demo app (which doesn't have a database) uses the ASP.Net session
/// class. The interface is abstracted in case something real is made out of this proof
/// of concept.
/// </remarks>
public class BrowserSession
{
static readonly string cSessionKey = "ariSession";
public static BrowserSession Get(HttpContext context)
{
BrowserSession session = context.Session[cSessionKey] as BrowserSession;
if (session == null)
{
session = new BrowserSession();
context.Session[cSessionKey] = session;
}
return session;
}
private BrowserSession()
{
A11y = new JSObject();
Responses = new Dictionary<string,JSObject>();
}
public JSObject A11y { get; set; }
public Dictionary<string, JSObject> Responses { get; private set; }
}
}