public static void Execute(HttpServerUtility server, HttpResponse response)
        {
            Exception exc = server.GetLastError();

            if (exc.GetType() == typeof(HttpException))
            {
                if (exc.Message.Contains("NoCatch") || exc.Message.Contains("maxUrlLength"))
                {
                    return;
                }

                server.Transfer("HttpErrorPage.aspx");
            }
            else if (exc.GetType() == typeof(DinazorAuthorizationException))
            {
                RedirectDinazorResult.RedirectWithData(new DinazorResult()
                {
                    Status  = ResultStatus.Unauthorized,
                    Message = exc.Message
                });
            }

            Log.Error(exc);
            server.ClearError();
        }
Ejemplo n.º 2
0
 /**
  * Transfers control to the Error page using Server.Transfer, and displays some error information.
  *
  * header: The error page header, ex. "Page not found". HTML in the string is not escaped.
  * description: A description of the error, ex. "Path /foo/bar.txt not found". HTML in the string is not escaped.
  * code: The response code of the page, ex. 404.
  */
 public static void transferToError(HttpServerUtility server, HttpContext context, string header, string description, int code)
 {
     context.Items.Clear();
     context.Items ["ErrorPage_title"] = header;
     context.Items ["ErrorPage_desc"]  = description;
     context.Items ["ErrorPage_code"]  = code;
     server.Transfer("~/ErrorPage.aspx", false);
 }
Ejemplo n.º 3
0
 //Fungerar som en omstart och rensar alla inmatningsrutor odyl + display:
 public void button_Refresh_TB(HttpServerUtility server, string retursida)
 {
     try
     {
         server.Transfer(retursida);
     }
     finally
     { }
 }
Ejemplo n.º 4
0
        public static void CheckLevelData(DataRow _levelData, HttpServerUtility Server)
        {
            if (_levelData == null) //no more levels
            {
                alert("Glückwunsch! Sie haben alle Aufgaben gelöst! In nächster Zukunft werden hier neue Aufgaben erscheinen.");

                //redirect
                Server.Transfer("Default.aspx");
            }
        }
Ejemplo n.º 5
0
        public static void CheckUserData(DataRow _userData, HttpServerUtility Server)
        {
            if (_userData == null) //not logged in
            {
                alert("Sie sind nicht angemeldet. Bitte melden Sie sich an.");

                //redirect
                Server.Transfer("Default.aspx");
            }
        }
Ejemplo n.º 6
0
        //public static string stringOfConnection = Pwds.localConString;

        public static void CheckAdmin(IPrincipal User, HttpServerUtility Server)
        {
            if (User.IsInRole("admin"))
            {
                return;
            }

            alert("Diese Seite erfordert Administrationsrechte. Bitte melden Sie sich an.");
            Server.Transfer(@"~/Account/Login.aspx");
        }
Ejemplo n.º 7
0
        //Fungerar som en omstart och rensar alla inmatningsrutor odyl + display:
        public void button_Refresh_TB(HttpServerUtility server, string retursida)
        {
            SetChks_Artist db  = new SetChks_Artist();
            Int32          val = 0;

            try
            {
                db.UpdateRecord_Artist_ChkBox(val);
                server.Transfer(retursida);
            }
            finally
            { }
        }
 public static void ModernTransfer(this HttpServerUtility httpServerUtility, string path, bool preserveForm)
 {
     if (httpServerUtility == null)
     {
         throw new ArgumentNullException("httpServerUtility");
     }
     if (HttpRuntime.UsingIntegratedPipeline)
     {
         httpServerUtility.TransferRequest(path, preserveForm);
     }
     else
     {
         httpServerUtility.Transfer(path, preserveForm);
     }
 }
Ejemplo n.º 9
0
        public static void Execute(HttpServerUtility server, HttpResponse response)
        {
            Exception exc = server.GetLastError();

            if (exc.GetType() == typeof(HttpException))
            {
                if (exc.Message.Contains("NoCatch") || exc.Message.Contains("maxUrlLength"))
                {
                    return;
                }

                server.Transfer("HttpErrorPage.aspx");
            }
            Log.Error(exc);
            server.ClearError();
        }
 public override void Transfer(string path)
 {
     _httpServerUtility.Transfer(path);
 }
Ejemplo n.º 11
0
 public override void Transfer(string path)
 {
     _server.Transfer(path);
 }
        public void Methods_Deny_Unrestricted()
        {
            hsu.ClearError();

            Assert.IsNull(hsu.GetLastError(), "GetLastError");

            Assert.IsNotNull(hsu.HtmlDecode(String.Empty), "HtmlDecode(string)");
            hsu.HtmlDecode(String.Empty, sw);

            Assert.IsNotNull(hsu.HtmlEncode(String.Empty), "HtmlEncode(string)");
            hsu.HtmlEncode(String.Empty, sw);

            try
            {
                Assert.IsNull(hsu.MapPath(String.Empty), "MapPath(string)");
            }
            catch (NullReferenceException)
            {
                // ms 1.x
            }

            try
            {
                hsu.Transfer("/");
            }
            catch (NullReferenceException)
            {
                // ms
            }
            try
            {
                hsu.Transfer("/", true);
            }
            catch (NullReferenceException)
            {
                // ms
            }
            try
            {
                hsu.Transfer("/", false);
            }
            catch (NullReferenceException)
            {
                // ms
            }
#if NET_2_0
            try
            {
                hsu.Transfer((IHttpHandler)null, true);
            }
            catch (NullReferenceException)
            {
                // ms
            }
            try
            {
                hsu.Transfer((IHttpHandler)null, false);
            }
            catch (NullReferenceException)
            {
                // ms
            }
#endif
            try
            {
                Assert.IsNotNull(hsu.UrlDecode(url), "UrlDecode(string)");
            }
            catch (NullReferenceException)
            {
                // ms
            }
            try
            {
                hsu.UrlDecode("http://www.mono-project.com/", sw);
            }
            catch (NullReferenceException)
            {
                // ms
            }

            Assert.IsNotNull(hsu.UrlEncode(String.Empty), "UrlEncode(string)");
            hsu.UrlEncode(String.Empty, sw);

            Assert.IsNotNull(hsu.UrlPathEncode(String.Empty), "UrlPathEncode(string)");
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Redirects a client to the "Page Not Found" page.
        /// </summary>
        /// <param name="server">The <see cref="HttpServerUtility"/> for processing web requests.</param>
        public static void RedirectPageNotFound(this HttpServerUtility server)
        {
            CustomErrorsSection errors = ConfigurationManager.GetSection("system.web/customErrors") as CustomErrorsSection;

            server.Transfer(errors != null ? (errors.Errors["404"] != null) ? errors.Errors["404"].Redirect : errors.DefaultRedirect : string.Format("~/InvalidUrl_{0}.aspx", DateTime.Now.Ticks), true);
        }