2. 配置web.config的基本信息
<configSections>
<section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
</configSections>
<system.web>
<httpHandlers>
<!--使用URLRewriter.dll -->
<add verb="*" path="*.aspx" type="URLRewriter.RewriterFactoryHandler, URLRewriter" />
<add verb="*" path="*.html" type="URLRewriter.RewriterFactoryHandler, URLRewriter" /> </httpHandlers>
<compilation debug="true" targetFramework="4.0"/>
</system.web>
<!--重写规则-->
<RewriterConfig>
<Rules>
<RewriterRule>
<LookFor>~/index.html</LookFor>
<SendTo>~/Index.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/Product/detail/item/([0-9]*).html</LookFor>
<SendTo>~/Product_Detail.aspx?ID=$1</SendTo>
</RewriterRule>
<!--分页规则开始-->
<RewriterRule>
<LookFor>~/Product/list/item/(.*)_(.*)\.html</LookFor>
<SendTo>~/Product_List.aspx?ID=$1&page=$2</SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>
到这里伪静态就可以使用了
3.伪静态分页
⑴ 分页控件代码
<webdiyer:AspNetPager ID="AspNetPager1" runat="server" FirstPageText="首页" LastPageText="尾页"
NextPageText="下一页" PageIndexBoxType="DropDownList" PrevPageText="上一页" ShowCustomInfoSection="Left"
ShowPageIndexBox="Always" SubmitButtonText="Go" ShowPageIndex="False" TextAfterPageIndexBox="页"
TextBeforePageIndexBox="转到" AlwaysShow="True" LayoutType="Table" CssClass="paginator"
CustomInfoClass="paginator" CustomInfoSectionWidth="" Wrap="False" PageSize=""
OnPageChanging="AspNetPager1_PageChanging" UrlPaging="True">
</webdiyer:AspNetPager>
⑵ .cs代码
AspNetPager1.UrlRewritePattern = "/Product/list/" + type + "_" + ID + "_{0}.html";
4. 相关参考质料
(4)ASP.NET伪静态页面的实现和伪静态在IIS7.0中的配置
(5)ASP.NET伪静态实现