扩展名更少网址的自定义错误页面

时间:2013-07-10 08:13:14

标签: asp.net dotnetnuke custom-error-pages wildcard-mapping

我有一个DotNetNuke 7网站,我已经启用了这样的自定义错误:

    <customErrors mode="On" defaultRedirect="Error.aspx">
        <error statusCode="404" redirect="FileNotFound.aspx" />
    </customErrors>

我还想为无扩展名的网址添加此类错误,但是当我尝试添加通配符映射时,它会在http://mysite.com等上使用404中断网站

<add name="WILDCARDMAPPING" path="*" verb="*" type="" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="None" allowPathInfo="false" preCondition="integratedMode,bitness64" />

如何设置处理程序..

<handlers accessPolicy="Read, Execute, Script">
        <remove name="WebServiceHandlerFactory-Integrated" />
        <add name="LogoffHandler*" path="Logoff.aspx" verb="*" type="DotNetNuke.Services.Authentication.LogOffHandler, DotNetNuke" preCondition="integratedMode" />
        <add name="RSSHandler" path="RSS.aspx" verb="*" type="DotNetNuke.Services.Syndication.RssHandler, DotNetNuke" preCondition="integratedMode" />
        <add name="LinkClickHandler" path="LinkClick.aspx" verb="*" type="DotNetNuke.Services.FileSystem.FileServerHandler, DotNetNuke" preCondition="integratedMode" />
        <add name="CaptchaHandler" path="*.captcha.aspx" verb="*" type="DotNetNuke.UI.WebControls.CaptchaHandler, DotNetNuke" preCondition="integratedMode" />
        <add name="UserProfilePageHandler" path="User.aspx" verb="*" type="DotNetNuke.Services.UserProfile.UserProfilePageHandler, DotNetNuke" preCondition="integratedMode" />
        <add name="RadProgressHandler" verb="*" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.Upload.RadUploadProgressHandler, Telerik.Web.UI" preCondition="integratedMode" />
        <add name="UserProfilePicHandler" path="ProfilePic.ashx" verb="*" type="DotNetNuke.Services.UserProfile.UserProfilePicHandler, DotNetNuke" preCondition="integratedMode" />
        <remove name="ExtensionlessUrl-Integrated-4.0" />
        <add name="ExtensionlessUrl-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
        <add name="SitemapHandler" path="Sitemap.aspx" verb="*" type="DotNetNuke.Services.Sitemap.SitemapHandler, DotNetNuke" preCondition="integratedMode" />
        <add name="ClientDependencyHandler" verb="*" path="DependencyHandler.axd" type="ClientDependency.Core.CompositeFiles.CompositeDependencyHandler, ClientDependency.Core" preCondition="integratedMode" />
        <add name="Telerik.Web.UI.WebResource" verb="*" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource, Telerik.Web.UI" preCondition="integratedMode" />
        <add name="Telerik.Web.UI.ChartHttpHandler" verb="*" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler, Telerik.Web.UI, Culture=neutral, PublicKeyToken=121fae78165ba3d4" />
        <add name="HtmTemplateFileHandler" verb="*" path="*.htmtemplate" type="DotNetNuke.Providers.RadEditorProvider.HtmTemplateFileHandler, DotNetNuke.RadEditorProvider" preCondition="integratedMode" />
        <add name="WILDCARDMAPPING" path="*" verb="*" type="" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="None" allowPathInfo="false" preCondition="integratedMode,bitness64" />
    </handlers>

我试过电影WILDCARDMAPPING处理程序我添加到顶部,中间但它不起作用。

DNN已经为已添加到CMS的页面(如/ Home)提供了对无扩展名网址的支持,但显示/ somepage的正常404错误消息。

3 个答案:

答案 0 :(得分:0)

只需在每个目录中添加一个index.html,其中显示您要为该案例显示的内容 - 默认情况下,http://SomeUrl/some/path/会打开/尝试打开http://SomeUrl/some/path/index.html

答案 1 :(得分:0)

这有效:

  <system.webServer>
    <httpErrors>
      <remove statusCode="404" subStatusCode="-1" />
      <error statusCode="404" path="/FileNotFound.aspx" responseMode="ExecuteURL" />
    </httpErrors>
  </system.webServer>

答案 2 :(得分:0)

DNN 7.1包括新的“高级URL提供商”(基于iFinity的URL Master扩展),其中包括对404页面和内容的内置支持。无扩展名的网址。在新的DNN 7.1站点中有一个名为“404错误页面”的页面(您必须在升级的站点中手动创建它,请参阅http://www.dnnsoftware.com/answers/cid/350985上的已接受答案),该页面将返回发现(是否有延伸)。

相关: