-
Notifications
You must be signed in to change notification settings - Fork 0
/
SiteNavigator.cs
107 lines (90 loc) · 3.11 KB
/
SiteNavigator.cs
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
namespace Seattle.DoIT.PoliceReports.Web
{
internal class SiteNavigator
{
private static string _userRegistrationUrl = "~/UserRegistration.aspx";
private static string _accessDeniedUrl = "~/AccessDenied.aspx";
private static string _policeReportNotFoundUrl = "~/PoliceReportNotFound.aspx";
private static string _userRegistrationGadgetUrl = "~/gadgets/UserRegistrationGadget.aspx";
private static string _signInRequiredGadgetUrl = "~/gadgets/SignInRequired.aspx";
private static string _accessRevokedGadgetUrl = "~/gadgets/AccessRevoked.aspx";
private SiteNavigator() { }
public static void Redirect(string url)
{
try
{
HttpContext.Current.Response.Redirect(url);
}
catch (System.Threading.ThreadAbortException)
{
}
}
public static void Transfer(string url)
{
try
{
HttpContext.Current.Server.Transfer(url);
}
catch (System.Threading.ThreadAbortException)
{
}
}
public static void RedirectToSignInPage()
{
FormsAuthentication.RedirectToLoginPage();
}
public static void RedirectToUserRegistrationPage()
{
Redirect(_userRegistrationUrl);
}
public static void TransferToUserRegistrationPage()
{
Transfer(_userRegistrationUrl);
}
private static string GetUserRegistrationUrlWithDestination(string destUrl)
{
return _userRegistrationUrl + "?dest=" + HttpContext.Current.Server.UrlEncode(destUrl);
}
public static void RedirectToUserRegistrationPage(string destUrl)
{
Redirect(GetUserRegistrationUrlWithDestination(destUrl));
}
public static void TransferToUserRegistrationPage(string destUrl)
{
Transfer(GetUserRegistrationUrlWithDestination(destUrl));
}
public static void RedirectToAccessDeniedPage()
{
Redirect(_accessDeniedUrl);
}
private static string GetUserRegistrationGadgetUrlWithDestination(string destUrl)
{
return _userRegistrationGadgetUrl + "?dest=" + HttpContext.Current.Server.UrlEncode(destUrl);
}
public static void RedirectToUserRegistrationGadgetPage(string destUrl)
{
Redirect(GetUserRegistrationGadgetUrlWithDestination(destUrl));
}
public static void TransferToUserRegistrationGadgetPage(string destUrl)
{
Transfer(GetUserRegistrationGadgetUrlWithDestination(destUrl));
}
public static void RedirectToAccessRevokedGadgetPage()
{
Redirect(_accessRevokedGadgetUrl);
}
public static void RedirectToSignInRequiredGadgetPage()
{
Redirect(_signInRequiredGadgetUrl);
}
public static void RedirectToPoliceReportNotFoundPage()
{
Redirect(_policeReportNotFoundUrl);
}
}
}