示例#1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (null == Request.Cookies[Settings.Default.SessionCookieKey])
         {
             LoginInfo.Text = "Please <a href=\"Account/Login.aspx\">Log in</a>";
         }
         else if (String.IsNullOrEmpty(Request.Cookies[Settings.Default.SessionCookieKey].Value))
         {
             LoginInfo.Text = "Please <a href=\"Account/Login.aspx\">Log in</a>";
         }
         else
         {
             Int64 UserID = UserMgmt.LookupSession(Request.Cookies[Settings.Default.SessionCookieKey].Value);
             LoginInfo.Text = "Welcome to the world of secure banking, " + UserMgmt.LookupUsername(UserID) + "!<br />" +
                              "<a href=\"Logout.aspx\">Log out</a>";
         }
     }
     catch (Exception ex)
     {
         ErrorLogging.AddException("Error in " + Path.GetFileName(Request.PhysicalPath), ex);
         Response.Write(ex.ToString());
     }
 }
示例#2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (null != Request.Cookies[Settings.Default.SessionCookieKey])
         {
             Int64 userID = UserMgmt.LookupSession(Request.Cookies[Settings.Default.SessionCookieKey].Value);
             if (0 == userID || "admin" != UserMgmt.LookupUsername(userID).ToLower())
             {
                 Response.Redirect("404.aspx?AttemptedUrl=/ApplyForAccount.aspx");
             }
         }
     }
     catch (Exception ex)
     {
         ErrorLogging.AddException("Error in " + Path.GetFileName(Request.PhysicalPath), ex);
         message.Visible = true;
         message.Text    = ex.ToString();
     }
 }