我爱Aspx >> Asp.Net >> ASP.net的URL重写有关于URL的重写,本文也只是拿来主意。相继有MS的组件“URLRewriter”和在Global.asax里的“Application_BeginRequest()”编码方式,以及IIS里的ISAPI设置。
娜列下来,实现方法也都很简单。
方法一:MS组件
这里也不用详解了,相关请看:
http://www.microsoft.com/china/msdn/library/webservices/asp.net/URLRewriting.mspx
用法很简单,只需要把组件URLRewriter.dll拷到应用程序的bin目录下,然后在web.config下加入如下代码:
在<configuration></configuration>中加入:
<configSections>
<section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter" />
</configSections>
<RewriterConfig>
<Rules>
<RewriterRule>
<LookFor>~/(\d{4})/(\d{2})/Default\.aspx</LookFor>
<SendTo>~/Default.aspx?ID=$1</SendTo>
</RewriterRule>
</Rules>
</RewriterConfig>
然后在<system.web></system.web>中加入:
Ҷƪл˵?
ASP.NET 2.0 Tips(1):跨页提交[05-20]
ASP.NET远程建立IIS虚拟主机并指..[05-20]
ASP.NET远程建立IIS虚拟主机并指..[05-20]
用ASP.NET对IIS中的虚拟目录进行..[05-20]
用ASP.NET对IIS中的虚拟目录进行..[05-20]
Asp程序错误详细说明例表[05-20]
asp动态include文件[05-20]
.Net中的MD5加密-16位32位[05-20]
.Net中的MD5加密-16位32位[05-20]
一个用asp备份与恢复SQL Server数..[05-20]
常用编码工具类,支持base64,md5,..[05-20]
C#远程重启计算机[05-20]
使用JS创建虚拟目录,并引导进入浏..[05-20]
设置Windows系统NTFS某个目录的用..[05-20]
Render方法生成静态页[05-20]
ASP.NET 2.0 Tips(1):跨页提交[05-20]
创建记录文件类[05-20]
用Visual C#动态生成组件[05-20]
web组件的通信---浅谈事件[05-20]
WMI使用技巧集[05-20]