Пример #1
0
        /// <summary>
        /// Determines if the condition is matched.
        /// </summary>
        /// <param name="context">The rewriting context.</param>
        /// <returns>True if the condition is met.</returns>
        public bool IsMatch(RewriteContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            // Use double-checked locking pattern to synchronise access to the regex.
            if (_regex == null)
            {
                lock (this)
                {
                    if (_regex == null)
                    {
                        _regex = new Regex(context.ResolveLocation(Pattern), RegexOptions.IgnoreCase);
                    }
                }
            }

            Match match = _regex.Match(context.Location);
            if (match.Success)
            {
                context.LastMatch = match;
            }

            return match.Success;
        }
		/// <summary>
		/// Determines if the condition is matched.
		/// </summary>
		/// <param name="context">The rewriting context.</param>
		/// <returns>True if the condition is met.</returns>
		public bool IsMatch(RewriteContext context)
		{
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            if (_regex == null)
			{
				lock (this)
				{
					if (_regex == null)
					{
						_regex = new Regex(context.ResolveLocation(Pattern), RegexOptions.IgnoreCase);
					}
				}
			}

			Match match = _regex.Match(context.Location);
			if (match.Success)
			{
				context.LastMatch = match;
				return true;
			}
			else
			{
				return false;
			}
		}
Пример #3
0
        /// <summary>
        /// Determines if the condition is matched.
        /// </summary>
        /// <param name="context">The rewriting context.</param>
        /// <returns>True if the condition is met.</returns>
        public bool IsMatch(RewriteContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            if (this._regex == null)
            {
                lock (this)
                {
                    if (this._regex == null)
                    {
                        this._regex = new Regex(context.ResolveLocation(this.Pattern), RegexOptions.IgnoreCase);
                    }
                }
            }

            var match = this._regex.Match(context.Location);

            if (match.Success)
            {
                context.LastMatch = match;
                return(true);
            }

            return(false);
        }
Пример #4
0
        /// <summary>
        /// Determines if the condition is matched.
        /// </summary>
        /// <param name="context">The rewriting context.</param>
        /// <returns>True if the condition is met.</returns>
        public bool IsMatch(RewriteContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            // Use double-checked locking pattern to synchronise access to the regex.
            if (_regex == null)
            {
                lock (this)
                {
                    if (_regex == null)
                    {
                        _regex = new Regex(context.ResolveLocation(Pattern), RegexOptions.IgnoreCase);
                    }
                }
            }

            Match match = _regex.Match(context.Location);

            if (match.Success)
            {
                context.LastMatch = match;
            }

            return(match.Success);
        }
 /// <summary>
 ///     Executes the action.
 /// </summary>
 /// <param name="context">The rewriting context.</param>
 public virtual RewriteProcessing Execute(RewriteContext context)
 {
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     context.Location = context.ResolveLocation(context.Expand(Location));
     return RewriteProcessing.StopProcessing;
 }
Пример #6
0
 /// <summary>
 /// Executes the action.
 /// </summary>
 /// <param name="context">The rewriting context.</param>
 public virtual RewriteProcessing Execute(RewriteContext context)
 {
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     context.Location = context.ResolveLocation(context.Expand(Location));
     return(RewriteProcessing.StopProcessing);
 }
Пример #7
0
        /// <summary>
        /// Executes the action.
        /// </summary>
        /// <param name="context">The rewriting context.</param>
        public virtual RewriteProcessing Execute(RewriteContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            //TODO: MAKE THIS MORE GENERIC
            if (!context.Location.ToUpperInvariant().Contains("/LOGIN/"))
            {
                context.Location = context.ResolveLocation(context.Expand(Location));
            }

            return(RewriteProcessing.StopProcessing);
        }