ASP.NET擬似静的方法及び関連資料
12041 ワード
1.URLRewriterを追加する.dll参照
2.webを構成する.configの基本情報
ここまでは擬似静的で使えます
3.擬似静的ページング
⑴ページングコントロールコード
⑵ .csコード
4.関連参考材料
(1)ASP.NETでURL書き換えを実行
(2)ASP.NET実装擬似静的Webページメソッド
(3)IIS 7擬似静的web.config構成方法
(4)ASP.NET擬似静態ページの実現と擬似静態はIIS 7である.0の構成
(5)ASP.NET擬似静的実装
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>
<RewriterRule>
<LookFor>~/Product/list/item/(.*)\.html</LookFor>
<SendTo>~/Product_List.aspx?ID=$1</SendTo>
</RewriterRule>
<!-- -->
<!-- -->
<RewriterRule>
<LookFor>~/Product/list/(.*)_(.*)_(.*)\.html</LookFor>
<SendTo>~/Product_List.aspx?type=$1&ID=$2&page=$3</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/Product/list/(.*)_(.*)\.html</LookFor>
<SendTo>~/Product_List.aspx?type=$1&ID=$2</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/Product/BuyNow.html</LookFor>
<SendTo>~/Buy_now.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/AlipayInfo.html</LookFor>
<SendTo>~/Skin/js/AlipayInfo.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/PayToAlipay.html</LookFor>
<SendTo>~/Skin/js/PayToAlipay.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/PayDetail.html</LookFor>
<SendTo>~/skin/js/Paydetail.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/404error.html</LookFor>
<SendTo>~/404.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/ShoppingCart.html</LookFor>
<SendTo>~/ShoppingCart.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/CartList.html</LookFor>
<SendTo>~/CartListBuyNow.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/CartAlipay.html</LookFor>
<SendTo>~/CartListCookie/CartListToAlipay.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/CartWxpay.html</LookFor>
<SendTo>~/CartListCookie/CarListWxPayApi.aspx</SendTo>
</RewriterRule>
<RewriterRule>
<LookFor>~/Agreement/index.html</LookFor>
<SendTo>~/Agreement.aspx</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="10"
OnPageChanging="AspNetPager1_PageChanging" UrlPaging="True">
</webdiyer:AspNetPager>
⑵ .csコード
DataDictRef ddr = new DataDictRefBLL().GetDetail(type);
if (ddr != null)
{
typename = "<span>" + ddr.DataDictRefName + "<span/>";
replist.DataSource = new T_T_BusinessProductBLL().GetListByTypeID(type, this.AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, ref recordCount);
AspNetPager1.UrlRewritePattern = "/Product/list/" + type + "_" + ID + "_{0}.html";
}else
{
Response.Redirect("/404error.html");
}
4.関連参考材料
(1)ASP.NETでURL書き換えを実行
(2)ASP.NET実装擬似静的Webページメソッド
(3)IIS 7擬似静的web.config構成方法
(4)ASP.NET擬似静態ページの実現と擬似静態はIIS 7である.0の構成
(5)ASP.NET擬似静的実装