【问题标题】:404 Pages when tampering with the extention of the page篡改页面扩展名时出现404页面
【发布时间】:2012-08-20 00:40:30
【问题描述】:

我有一个 Sitecore 解决方案,我们在其中处理 404 请求。

我们通过在 web.config 中设置“ErrorPage”和“ItemNotFoundUrl”来做到这一点:

<setting name="ErrorPage" value="/sitecore/service/error.aspx" />

<setting name="ItemNotFoundUrl" value="/Global/ErrorPages/404" />

现在,这在我们编辑页面名称时有效。因此,如果我们有 www.domain.com/mypage.aspx ,然后转到不存在的 www.domain.com/mysdfsa.aspx ,它将显示我们的错误页面。

但是,如果我们这样做:

www.domain.com/mypage.zip / www.domain.com/mypage.gosfgfgs

它给出了 IIS 错误:

Error Summary
HTTP Error 404.0 - Not Found
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

我尝试了什么?

我们至少需要为 ZIP 文件制作它。

  • 确保将 .ZIP 添加到 IIS 和 Sitecore MIME 类型中
  • 在 ExecuteRequest 管道之前挂钩并尝试重定向(这从未被调用,因为 IIS 在我们执行请求之前会给出错误页面)

有什么想法吗? :-) 谢谢

【问题讨论】:

    标签: asp.net iis-7 webforms http-status-code-404 sitecore


    【解决方案1】:

    我认为在&lt;preprocessRequest&gt; 管道中有一个处理器用于Sitecore 处理的扩展。您应该尝试更新:

    <processor type="Sitecore.Pipelines.PreprocessRequest.FilterUrlExtensions, Sitecore.Kernel">
      <param desc="Allowed extensions (comma separated)">aspx, ashx, asmx</param>
      <param desc="Blocked extensions (comma separated)">*</param>
      <param desc="Blocked extensions that stream files (comma separated)">*</param>
      <param desc="Blocked extensions that do not stream files (comma separated)"></param>
    </processor>
    

    【讨论】:

    • 确保您的 IIS 将 404 消息处理到 Sitecore 设置到的同一页面会更正确。
    猜你喜欢
    • 2012-12-21
    • 1970-01-01
    • 1970-01-01
    • 2012-09-10
    • 2010-09-17
    • 1970-01-01
    • 1970-01-01
    • 2013-07-16
    • 2017-09-24
    相关资源
    最近更新 更多