URLRewriter能不能把规则放在XMl文件中
<Rules>
  <RewriterRule>
    <LookFor>~/Index.html</LookFor>
    <SendTo>~/Index.aspx</SendTo>
  </RewriterRule>  <RewriterRule>
    <LookFor>~/Index.html</LookFor>
    <SendTo>~/Video/Video.aspx</SendTo>
  </RewriterRule>  <RewriterRule>
    <LookFor>~/Img.html</LookFor>
    <SendTo>~/Picture/Img.aspx</SendTo>
  </RewriterRule>
</Rules>
如果可以  怎样写??  注意:是URLRewriter哦

解决方案 »

  1.   

    可以放
    <RewriterConfig configSource="configs\aNd1coder.UrlRewriter.config"></RewriterConfig>public static RewriterConfiguration ReadUrlRewriteFile()
            {
                XmlDocument xmldoc = new XmlDocument();
                xmldoc.Load(HttpContext.Current.Server.MapPath("你的xml或Config文件路径"));
                XmlNode section = xmldoc.LastChild;
                XmlSerializer ser = new XmlSerializer(typeof(RewriterConfiguration));
                return (RewriterConfiguration)ser.Deserialize(new XmlNodeReader(section));
            }