Пример #1
0
        public override bool Equals(object customError)
        {
            CustomError e = customError as CustomError;

            if (e == null)
            {
                return(false);
            }

            return(Redirect == e.Redirect && StatusCode == e.StatusCode);
        }
        public void Set(CustomError customError)
        {
            CustomError existing = Get(customError.StatusCode.ToString());

            if (existing == null)
            {
                Add(customError);
            }
            else
            {
                int index = BaseIndexOf(existing);
                RemoveAt(index);
                BaseAdd(index, customError);
            }
        }
Пример #3
0
 internal string GetRedirectString(int code)
 {
     string absoluteRedirect = null;
     if (this.Errors != null)
     {
         CustomError error = this.Errors[code.ToString(CultureInfo.InvariantCulture)];
         if (error != null)
         {
             absoluteRedirect = GetAbsoluteRedirect(error.Redirect, this.basepath);
         }
     }
     if (absoluteRedirect == null)
     {
         absoluteRedirect = this.DefaultAbsolutePath;
     }
     return absoluteRedirect;
 }
Пример #4
0
        internal String GetRedirectString(int code)
        {
            String r = null;

            if (Errors != null)
            {
                CustomError ce = Errors[(string)code.ToString(CultureInfo.InvariantCulture)];
                if (ce != null)
                {
                    r = GetAbsoluteRedirect(ce.Redirect, basepath);
                }
            }

            if (r == null)
            {
                r = DefaultAbsolutePath;
            }

            return(r);
        }
 // public methods
 public void Add(CustomError customError) {
     BaseAdd(customError);
 }
 public void Set(CustomError customError) {
     BaseAdd(customError, false);
 }
Пример #7
0
        // I believe these can be removed
        public override bool Equals(object customError)
        {
            CustomError o = customError as CustomError;

            return(o != null && o.StatusCode == StatusCode && o.Redirect == Redirect);
        }
 public void Set(CustomError customError)
 {
 }
 public void Add(CustomError customError)
 {
 }
        public override bool Equals(object customError)
        {
            CustomError error = customError as CustomError;

            return(((error != null) && (error.StatusCode == this.StatusCode)) && (error.Redirect == this.Redirect));
        }
 public void Set(CustomError customError)
 {
 }
 public void Add(CustomError customError)
 {
 }
Пример #13
0
		public void Set (CustomError customError)
		{
			CustomError existing = Get (customError.StatusCode.ToString());

			if (existing == null) {
				Add (customError);
			}
			else {
				int index = BaseIndexOf (existing);
				RemoveAt (index);
				BaseAdd (index, customError);
			}
		}
Пример #14
0
		public void SetToDuplicate ()
		{
			CustomErrorCollection col = new CustomErrorCollection ();

			col.Add (new CustomError (404, "http://404-error.com/"));
			col.Add (new CustomError (403, "http://403-error.com/"));
			col.Add (new CustomError (999, "http://403-error.com/"));

			/* override the 999 entry with a duplicate 403 */
			col[2] = new CustomError (403, "http://403-error2.com/");

			Assert.AreEqual (3, col.Count, "A1");
			Assert.AreEqual (3, col.AllKeys.Length, "A2");

			Assert.AreEqual (403, col[1].StatusCode, "A3");
			Assert.AreEqual ("http://403-error.com/", col[1].Redirect, "A4");
			Assert.AreEqual (403, col[2].StatusCode, "A5");
			Assert.AreEqual ("http://403-error2.com/", col[2].Redirect, "A6");
		}
 public void Add(CustomError customError)
 {
     BaseAdd(customError);
 }
 public void Set(CustomError customError)
 {
     base.BaseAdd(customError, false);
 }