使用urlRewritter.Net错误的页面链接

时间:2012-03-12 20:02:36

标签: asp.net url-rewriting urlrewriter.net

我正在使用urlRewritter.Net进行网址重写......这很正常......我在页面上有navigateurl "~/Index.aspx"的超链接,但点击该链接会将我带到“http: // localhost:2731 / CitiZenJourNalism / ViewProfile / Index.aspx“而不是”http:// localhost:2731 / CitiZenJourNalism / Index.aspx“

为什么?请帮忙.....

web.config代码

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

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

    <validation validateIntegratedModeConfiguration="false" />

  </system.webServer>

<rewriter>
    <rewrite url="~/ViewProfile/(.+)" to="~/ViewProfile.aspx?uid=$1" />
    <rewrite url="~/Reports/(.+)/(.+)" to="~/Reports.aspx?cat=$1&amp;id=$2" />


  </rewriter>

1 个答案:

答案 0 :(得分:0)

如果我说得对,你的配置中不需要“ViewProfile”字符串。简单地:

<rewrite url="~/(.+)" to="~/ViewProfile.aspx?uid=$1" />

这样做有用吗?