-
Notifications
You must be signed in to change notification settings - Fork 1
/
BrevetRegistration.aspx.cs
63 lines (51 loc) · 1.86 KB
/
BrevetRegistration.aspx.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class BrevetRegistration : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
checkLogin(true);
}
private void checkLogin(bool loginRequired)
{
Response.Cache.SetNoStore(); // Should disable browser's Back Button
// (1) Hide all hyperlinks that are available for autenthicated users only
hyperLinkClubManagement.Visible = false;
hyperLinkBrevetManagement.Visible = false;
hyperLinkRiderManagement.Visible = false;
hyperLinkBrevetRegistration.Visible = false;
if (loginRequired == true && Session["username"] == null)
{
Page.Response.Redirect("HomePage.aspx"); // Jump to the login page.
}
if (Session["username"] == null)
{
lbLoginInfo.Text = "You are not logged in";
btLogout.Visible = false;
}
if (Session["username"] != null)
{
lbLoginInfo.Text = "You are logged in as " + Session["username"];
btLogout.Visible = true;
// (2) Show all hyperlinks that are available for autenthicated users only
hyperLinkBrevetRegistration.Visible = true;
}
if (Session["administrator"] != null)
{
// (3) In addition, show all hyperlinks that are available for administrators only
hyperLinkClubManagement.Visible = true;
hyperLinkBrevetManagement.Visible = true;
hyperLinkRiderManagement.Visible = true;
}
}
protected void btLogout_Click(object sender, EventArgs e)
{
Session["username"] = null;
Session["administrator"] = null;
Page.Response.Redirect("HomePage.aspx");
}
}