/// <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"); } string filename = context.MapPath(context.Expand(_location)); return File.Exists(filename) || Directory.Exists(filename); }
/// <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"); } string filename = context.MapPath(context.Expand(_location)); return(File.Exists(filename) || Directory.Exists(filename)); }
/// <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"); } try { string filename = context.MapPath(context.Expand(_location)); return(File.Exists(filename) || Directory.Exists(filename)); } catch { // An HTTP exception or an I/O exception indicates that the file definitely // does not exist. return(false); } }
/// <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"); } try { string filename = context.MapPath(context.Expand(_location)); return File.Exists(filename) || Directory.Exists(filename); } catch { // An HTTP exception or an I/O exception indicates that the file definitely // does not exist. return false; } }