码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2014-05-26 03:23:09      阅读:215      评论:0      收藏:0      [点我收藏+]

标签:class   blog   c   code   tar   http   

<?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实现任意后缀名重写

标签:class   blog   c   code   tar   http   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!