URL Rewriting Multiple Parameters using Asp.net 2.0 C#, web.config
1> Download Intelligencia.UrlRewriter.dll copy to bin folder.
2> Create Web.config as following:
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="rewriter"
requirePermission="false"
type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
</configSections>
<system.web>
<httpModules>
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter"/>
</httpModules>
</system.web>
<rewriter>
<rewrite url="~/products/(.+).aspx" to="~/products.aspx?category=$1" />
<rewrite url="~/mainsearch/(.+)/(.+).aspx" to="~/mainsearch.aspx?URLID=$1&prdty=$2" />
</rewriter>
</configuration>
products page is for 1 parameter mainsearch is for 2 parameters.
No comments:
Post a Comment