2010-11-12 28 views
0

我使用UrlRewriting.net做的工作正常,而Im本地测试它, 它不在互联网上工作,为什么?有没有配置? 我只是做了什么都ScottGu说: link textUrl重写不在服务器上工作

感谢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> 
+0

提供更多信息,我们无法猜出问题所在...... – leppie 2010-11-12 05:30:36

+0

您看到的行为是什么?你在IIS上运行两次还是在本地使用开发服务器? – 2010-11-12 05:36:48

+0

你遇到的错误/异常?运行互联网版本的操作系统是什么? – leppie 2010-11-12 05:36:49

回答

2

这里是重要的部分,你将需要:

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

我的建议是,虽然,如果你是能够使用.Net 4,使用URL路由 - 它的方式更好。

+1

+1 .Net 4路由建议。 – 2010-11-12 16:35:50