Exemplo n.º 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;
			}
		}
Exemplo n.º 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);
        }
Exemplo n.º 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;
 }
Exemplo n.º 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);
 }
Exemplo n.º 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);
        }