现在我要做一个伪静态,用的是urlrewrite.dll
- C# code
<configSections> <section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" /> </configSections> <RewriterConfig> <Rules> <RewriterRule> <LookFor>~/(.[0-9]*)\</LookFor> <SendTo>~/index.aspx?id=$1</SendTo> </RewriterRule> <RewriterRule> <LookFor>~/(.[0-9]*)/(.[0-9]*)\</LookFor> <SendTo>~/list.aspx?id=$1&bid=$2</SendTo> </RewriterRule> <RewriterRule> <LookFor>~/index</LookFor> <SendTo>~/default.aspx</SendTo> </RewriterRule> </Rules> </RewriterConfig>
但是在这个里面
<SendTo>~/list.aspx?id=$1&bid=$2</SendTo>这里报错,原因是不能使用&,有什么好的解决办法吗
在线等待,急急急
------解决方案--------------------------------------------------------
& 改成 &
------解决方案--------------------------------------------------------
使用<![CDATA[ “内容” ]]方式
- XML code
<RewriterRule> <LookFor>~/(.[0-9]*)/(.[0-9]*)\</LookFor> <SendTo><![CDATA[~/list.aspx?id=$1&bid=$2]]</SendTo></RewriterRule>