花褪残红青杏小。燕子飞时,绿水人家绕。

Dutory自定义错误页面的方法

ZBLOG教程 十五楼的鸟儿 19483浏览 0评论

现在的dt是有一些错误的,比如你设置了某网站分类,之后删掉了,那么原链接就会报错,所以给出以下解决方案。
 

实例错误链接:http://key.nobird.org/list.aspx?catalogid=1&page=default
此错误页面不同于404,301等错误,此错误系屏蔽系统自身错误的一种方法,使得网站的体验更好。

修改方法,在web.config文件的<system.web>节点下添加<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
其中的mycustompage.htm是你自定义要显示错误的页面,也可以是某个网站地址。

注:如果你的DT是安装在子目录的,修改根目录的web.config即可。

附:一个修改后的dt配置文件。

复制以下代码为web.config文件即可。

<?xml version="1.0"?>
<!--
    Note: As an alternative to hand editing this file you can use the
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in
    machine.config.comments usually located in
    \Windows\Microsoft.Net\Framework\v2.x\Config
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
    <appSettings>
        <add key="Dutory_Container_AssemblyName" value="Dutory.Core.SQLite"/>
        <add key="Dutory_Container_TypeName" value="Dutory.Core.SQLite.Container"/>
        <add key="Dutory_RewriteConfig_FileName" value="~/rewrite.config"/>
        <add key="Dutory_Subdirectory" value=""/>
    </appSettings>
    <connectionStrings/>
    <system.web>
        <customErrors mode="RemoteOnly" defaultRedirect="http://nobird.org/blog/"/>
        <globalization culture="zh-CN"  fileEncoding="utf-8" requestEncoding="utf-8"  responseEncoding="utf-8"  />
        <pages buffer="true" enableViewState="false" maintainScrollPositionOnPostBack="false" validateRequest="false"/>
        <httpModules>
            <add type="Dutory.Portal.ModulePortal,Dutory.Portal" name="ModulePortal"/>
        </httpModules>
    </system.web>
</configuration>

 


转载请注明:鸟儿博客 » Dutory自定义错误页面的方法

与本文相关的文章

游客
发表我的评论 换个身份
取消评论

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址