URL重写步骤 【有用】
2010-02-05 11:10
106 查看
做个新闻系统,URL重写每个新闻
1. Web.config 的配置
<httpModules>
<add type="URLRewriter.ModuleRewriter, URLRewriter" name="ModuleRewriter" />
</httpModules>
<configSections>
<section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
</configSections>
<RewriterConfig>
<Rules>
<RewriterRule>
<LookFor>~/(\d+)\.aspx</LookFor>
<SendTo>~/Detail.aspx?ID=$1</SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>
2. 创建页面文件
<asp:Repeater ID="rptbulletin" runat="server">
<ItemTemplate>
<table cellspacing="0" cellpadding="0" width="100%" border="0">
<tbody>
<tr>
<td height="20">
<a class="Other" href='Log/<%# Eval("ID")%>.aspx' target="_blank" title='<%#Eval("Title") %>'>·<%# (Eval("Title") %></a>
</td>
</tr>
</tbody>
</table>
</ItemTemplate>
</asp:Repeater>
建立 BulletinDetails.aspx
PageLoad 方法中
string id = Request.QueryString["ID"];
if (id != null)
{
读取新闻信息
}
相关文章推荐
- url重写步骤
- [原创 URL重写步骤
- CentOS下安装KVM虚拟机的步骤,绝对有用!
- URL重写原理,步骤 url rewrite
- URL重写原理,步骤 url rewrite
- Ubuntu Apache 伪静态配置 url重写 步骤
- 【2015.07.13周一】【Thinkphp】【URL重写】隐藏index.php的步骤
- Dynamics CRMのアップデートインポートツール移植的准备步骤与有用的网页
- asp.net url重写方法和步骤
- 追女孩子的步骤和秘笈
- [Android Tips]Android 开发技巧 (二) 非常有用的优化工具Lint
- linux配置防火墙详细步骤(iptables命令使用方法)
- 推荐几个非常有用的工具
- vs2012配置gitHub管理代码详细步骤
- unbuntu系统( PC机 )中安装360wifi步骤
- 使用Rome实现网站RSS发布的简单步骤
- 20个非常有用的 Photoshop 背景设计教程
- jmeter 多用户登录多步骤访问系统
- 中间件apache安装部署步骤
- SQL注入的一般步骤及防范方法