来看个URL重写规则,哪里没有正确啊?时不时的就抛出404资源找不到的异常。另外追问下,正则表达式里面 . 号需不需要写成 \. ?
<!--Url 重写规则-->
<configSections>
<!-- The <configSections> element must contain a <section> tag for the <RewriterConfig> section element.
The type of the section handler is RewriterConfigSerializerSectionHandler, which is responsible for
deserializing the <RewriterConfig> section element into a RewriterConfig instance... -->
<section name= "RewriterConfig " type= "URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter "/>
</configSections>
<RewriterConfig>
<Rules>
<RewriterRule>
<LookFor> ~/(\w*)/archive/(\w*).aspx </LookFor>
<SendTo> ~/$1/archive.aspx?id=$2 </SendTo>
</RewriterRule>
<RewriterRule>
<LookFor> ~/(\w*)/categories/(\w*).aspx </LookFor>
<SendTo> ~/$1/default.aspx?id=$2 </SendTo>
</RewriterRule>
<RewriterRule>
<LookFor> ~/(\w*)/categories/(\d*)-(\d*).aspx </LookFor>
<SendTo> ~/$1/default.aspx?id=$2&page=$3 </SendTo>
</RewriterRule>
<RewriterRule>
<LookFor> ~/(\w*)/default-(\d*).aspx </LookFor>
<SendTo> ~/$1/default.aspx?page=$2 </SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>
------解决方案--------------------正则表达式里面 . 号需不需要写成 \.?
---->
.匹配除换行符以外的任意字符
www\.unibetter\.com匹配www.unibetter.com
------解决方案--------------------看楼主的意思,应该要加 "\ "