简体   繁体   中英

Url Rewriting not working on the server

what I done with UrlRewriting.net is just working well while Im locally testing it, it is not working on the internet why? is there any configuration? I just did what ever ScottGu said: link text

thanks inadvance

  <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/books.html" to="~/products.aspx" />
  </rewriter>  

</configuration>  

Here's the important parts you'll need:

<?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>

        <system.webServer>
            <validation validateIntegratedModeConfiguration="false"/>
            <modules runAllManagedModulesForAllRequests="true">
                <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule" />
            </modules>

                <!-- THE FOLLOWING LINE MUST BE PRESENT FOR AJAX & VALIDATION TO WORK WITH URLREWRITER.NET -->
                <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

            </handlers>
        </system.webServer>

        <!-- URL REWRITER -->
        <rewriter>
            <rewrite url="^~/About$" to="~/About.aspx" />
        </rewriter>
    </configuration>

My suggestion would be though, if you are able to use .Net 4, use URL Routing -it's way better.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM