
这两天研究地址重写,对于那些理论性很强的东西.说实话.我也没有太看进去..经过慢慢摸索也可以实现了..地址重写了.下边记录下来也算是个学习笔记吧!!
1.将urlWrite这个类载入到项目里..
2.在web.congfig里<configuration>下边加上下边这段代码.
<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>
<!-- Rules for Blog Content Displayer -->
<RewriterRule>
<LookFor>~/Article/(\S{1,10})</LookFor>//在这里可以命名你所需要的名字.
<SendTo><![CDATA[~/ArticleShow.aspx?id=$1]]></SendTo> //这里是需要重写的页面.
</RewriterRule>
<RewriterRule>
<LookFor>~/List/(\S{1,10})</LookFor> //()里边s代表字符串,1,10代表字符串的长度;
<SendTo><![CDATA[~/ArticleSort.aspx?id=$1]]></SendTo>//参数1之前一定要加上$这个符号.
</RewriterRule>
</Rules>
</RewriterConfig>
3.在 <system.web>下边加上以下代码..
<httpModules>
<add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter"/>
</httpModules>
4.完成以上3不步就可以在本地将地址重写了..服务器的研究中...
: 科技

