blob: 81281ebb659d21e7ece9ff85d1a076adc172232c (
plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Janrain.OpenId.Server;
/// <summary>
/// Summary description for State
/// </summary>
public class State
{
public State()
{
}
public static SessionState Session
{
get
{
if (HttpContext.Current.Session["SessionState"] == null) { HttpContext.Current.Session["SessionState"] = new SessionState(); }
return HttpContext.Current.Session["SessionState"] as SessionState;
}
}
public static Uri ServerUri
{
get
{
UriBuilder builder = new UriBuilder(HttpContext.Current.Request.Url);
builder.Path = HttpContext.Current.Response.ApplyAppPathModifier("~/server.aspx");
builder.Query = null;
builder.Fragment = null;
return new Uri(builder.ToString(), true);
}
}
[Serializable()]
public class SessionState
{
private CheckIdRequest lastRequest;
public CheckIdRequest LastRequest
{
get { return lastRequest; }
set { lastRequest = value; }
}
public void CheckExpectedSateIsAvailable()
{
if (LastRequest == null)
{
throw new ApplicationException("The CheckIdRequest has not been set. This usually means that Http Session is not available and the OpenID request needs to be restarted.");
}
}
public void Reset()
{
lastRequest = null;
}
}
}
|