首页 > 其他 > 详细

使用微软URLRewriter.dll的url实现任意后缀名重写

时间:2014-05-26 03:22:57      阅读:364      评论:0      收藏:0      [点我收藏+]
<?xml version="1.0"?>
<!--先引用URLRewriter.dll,放置于Bin目录-->
<configuration>
	<configSections>
		<!--配置重写规则节点-->
		<section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter"/>
	</configSections>
	<connectionStrings>
		<add name="TestConnectionString" connectionString="Data Source=.;Initial Catalog=Test;Integrated Security=True" providerName="System.Data.SqlClient"/>
	</connectionStrings>
	<!--重写规则-->
	<RewriterConfig>
		<Rules>
			<RewriterRule>
				<LookFor>~/product/([0-9]*)\.html</LookFor>            <!--http://www.xxx.com/product/8001.html-->
				<SendTo>~/product.aspx?pid=$1</SendTo>                 <!--http://www.xxx.com/product.aspx?pid=8001-->
			</RewriterRule>
			<RewriterRule>
				<LookFor>~/product/([0-9]*)-([0-9]*)\.html</LookFor>   <!--http://www.xxx.com/product/101-8001.html-->
				<SendTo>~/product.aspx?sid=$1&pid=$2</SendTo>      <!--http://www.xxx.com/product.aspx?sid=101&pid=8001-->
			</RewriterRule>
			<RewriterRule>
				<LookFor>~/product/([0-9]*)/([0-9]*)\.html</LookFor>   <!--http://www.xxx.com/product/101/8001.html-->
				<SendTo>~/product.aspx?sid=$1&pid=$2</SendTo>      <!--http://www.xxx.com/product.aspx?sid=101&pid=8001-->
			</RewriterRule>
		</Rules>
	</RewriterConfig>
	<system.web>
		<httpHandlers>
			<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>
</configuration>

使用微软URLRewriter.dll的url实现任意后缀名重写,布布扣,bubuko.com

使用微软URLRewriter.dll的url实现任意后缀名重写

原文:http://blog.csdn.net/smartsmile2012/article/details/26607415

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!