【问题标题】:wrong page link using urlRewritter.Net使用 urlRewritter.Net 的错误页面链接
【发布时间】:2012-03-29 06:15:06
【问题描述】:

我正在使用 urlRewritter.Net 进行 url 重写...效果很好...我在页面上有一个带有 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>

【问题讨论】:

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


    【解决方案1】:

    如果我理解正确,您的配置中不需要“ViewProfile”字符串。简单地说:

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

    这样可以吗?

    【讨论】:

    • 我的问题是,当我使用重写时,主页的链接会发生变化......我该如何解决这个问题??
    猜你喜欢
    • 2015-04-04
    • 1970-01-01
    • 1970-01-01
    • 2015-05-18
    • 2018-09-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多