Esempio n. 1
0
        protected void Application_Error(object sender, EventArgs e)
        {
            var objErr = Server.GetLastError().GetBaseException();

            if (objErr.Message.StartsWith("Path") && objErr.Message.Contains(".asp") && !objErr.Message.Contains(".aspx") && objErr.Message.EndsWith("forbidden."))
            {
                Response.Redirect(Request.RawUrl.Replace(".asp", ".aspx"), true);
                return;
            }

            if (!Convert.ToBoolean(ConfigurationManager.AppSettings["EnableSMTP"]))
            {
                return;
            }

            try
            {
                var usr  = WebUser.CreateUser();
                var body = Email.CreateErrorEmailBody(objErr, usr.Id);
                Utils.Email.ErrorMail("Error 500", body);
            }

            catch (System.Exception ex)
            {
                var err = "Error Caught in Application_Error event\n" + "Error in Application_Error event handler: " + Request.Url + "\nError Message:" + ex;

                System.Diagnostics.EventLog.WriteEntry("Application", err, System.Diagnostics.EventLogEntryType.Error);

                Utils.Email.ErrorMail("Pripev.ru error handler error", err, false);
            }
        }
Esempio n. 2
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            foreach (var attr in GetType().GetCustomAttributes(typeof(PageAttribute), true))
            {
                _dosValidation = ((PageAttribute)attr).DoSValidation;
                _createUser    = ((PageAttribute)attr).CreateUser;
            }

            if (_dosValidation && !ActionValidator.ValidateRequest(IsPostBack))
            {
                Response.End();
            }

            if (!_createUser)
            {
                return;
            }

            CurrentUser = WebUser.CreateUser();
            if (!CurrentUser.bLoggedIn)
            {
                CurrentUser.LoginFromCookie();
            }
        }
Esempio n. 3
0
 protected UserControl()
 {
     _webUser = WebUser.CreateUser();
     if (!_webUser.bLoggedIn)
     {
         _webUser.LoginFromCookie();
     }
 }
Esempio n. 4
0
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            if (!ActionValidator.ValidateRequest(IsPostBack))
            {
                Response.End();
            }

            CurrentUser = WebUser.CreateUser();
            if (!CurrentUser.bLoggedIn)
            {
                CurrentUser.LoginFromCookie();
            }
        }