RewriterRuleCollection.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Collections;
  3. namespace URLRewriter.Config
  4. {
  5. /// <summary>
  6. /// The RewriterRuleCollection models a set of RewriterRules in the Web.config file.
  7. /// </summary>
  8. /// <remarks>
  9. /// The RewriterRuleCollection is expressed in XML as:
  10. /// <code>
  11. /// &lt;RewriterRule&gt;
  12. /// &lt;LookFor&gt;<i>pattern to search for</i>&lt;/LookFor&gt;
  13. /// &lt;SendTo&gt;<i>string to redirect to</i>&lt;/LookFor&gt;
  14. /// &lt;RewriterRule&gt;
  15. /// &lt;RewriterRule&gt;
  16. /// &lt;LookFor&gt;<i>pattern to search for</i>&lt;/LookFor&gt;
  17. /// &lt;SendTo&gt;<i>string to redirect to</i>&lt;/LookFor&gt;
  18. /// &lt;RewriterRule&gt;
  19. /// ...
  20. /// &lt;RewriterRule&gt;
  21. /// &lt;LookFor&gt;<i>pattern to search for</i>&lt;/LookFor&gt;
  22. /// &lt;SendTo&gt;<i>string to redirect to</i>&lt;/LookFor&gt;
  23. /// &lt;RewriterRule&gt;
  24. /// </code>
  25. /// </remarks>
  26. [Serializable()]
  27. public class RewriterRuleCollection : CollectionBase
  28. {
  29. /// <summary>
  30. /// Adds a new RewriterRule to the collection.
  31. /// </summary>
  32. /// <param name="r">A RewriterRule instance.</param>
  33. public virtual void Add(RewriterRule r)
  34. {
  35. this.InnerList.Add(r);
  36. }
  37. /// <summary>
  38. /// Gets or sets a RewriterRule at a specified ordinal index.
  39. /// </summary>
  40. public RewriterRule this[int index]
  41. {
  42. get
  43. {
  44. return (RewriterRule) this.InnerList[index];
  45. }
  46. set
  47. {
  48. this.InnerList[index] = value;
  49. }
  50. }
  51. }
  52. }