コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!this.Page.User.Identity.IsAuthenticated || Session["ActiveUser"] == null)
                {
                    FormsAuthentication.RedirectToLoginPage();
                }

                if (!IsPostBack)
                {
                    try
                    {
                        User activeUser = null;

                        if (Session["ActiveUser"] != null)
                        {
                            activeUser = (User)Session["ActiveUser"];

                            if (activeUser.Admin || activeUser.Developer)
                            {
                                aboutInformation = cs.GetBuildInformation();
                                PopulateLines();
                            }
                            else
                            {
                                FormsAuthentication.RedirectToLoginPage();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Log.Error(ex.Message, ex);
                        Session["Error"] = ex.Message;

                        if (Request.Url.AbsoluteUri.Contains("Forms"))
                        {
                            Response.Redirect("ErrorForm.aspx");
                        }
                        else
                        {
                            Response.Redirect("Forms/ErrorForm.aspx");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message, ex);
                Response.Redirect("ErrorForm.aspx");
            }
        }