Learn As Much As You Can

Tuesday 2 April 2013

Url ReWriting Using Url Rewriter.Net


  1. Open your web project in Microsoft Visual Studio .NET.
  2. Add a reference to the Intelligencia.UrlRewriter assembly.
  3. Open the web.config file in your web project.
  4. Add the following in the web.config file:
  5. <configuration>
  6.   <configSections>
  7.     <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>

      
    <system.webServer>

        
    <modules runAllManagedModulesForAllRequests="true">
          
    <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule" />
        </
    modules>

        
    <validation validateIntegratedModeConfiguration="false" />

      </
    system.webServer>

      
    <rewriter>
        
    <rewrite url="~/products/(.+)" to="~/products.aspx?category=$1" />
      </
    rewriter>
      
    </configuration>
  8. And in the CS file or where ever you redirect to the page from put the text as in the url field like 
           Response.Redirect("~/products.aspx");

0 comments :

Post a Comment