gpt4 book ai didi

asp.net - 如何: Dnn Custom Error Pages

转载 作者:行者123 更新时间:2023-12-03 07:54:31 26 4
gpt4 key购买 nike

默认错误页面可能会显示很多信息,例如您所使用的语言和服务器以及此类信息。可能被恶意用户用来攻击您的网站和服务器。

默认错误页面的外观也非常丑陋和过时,这可能会损害您的品牌。

因此,始终建议使用自定义错误页面。

因此,发生错误时,如何在DNN中显示自定义错误页面?

最佳答案

1.禁用DNN错误处理,并让错误冒泡。

主机设置>>外观>>取消选中“是否使用自定义错误消息?”

2.To重定向用户到,可以是aspx页面,但我更喜欢HTML

然后使用样式在根目录下创建HTML页面

3.在启用Web.Config中的CustomErrors中:

<customErrors mode="On">
<error statusCode="500" redirect="/MyCustomError.html"/>
<error statusCode="404" redirect="/MyCustomError.html"/>
<error statusCode="403" redirect="/MyCustomError.html"/>
</customErrors>

您也可以使用以下web.config片段覆盖IIS错误页面并重定向到自定义错误页面。
<httpErrors>
<remove statusCode="404" subStatusCode="-1"/>
<error statusCode="404" prefixLanguageFilePath="" path="/MyCustomError.aspx" responseMode="ExecuteURL"/>
<remove statusCode="403" subStatusCode="-1"/>
<error statusCode="403" prefixLanguageFilePath="" path="/MyCustomError.html" responseMode="ExecuteURL"/>
</httpErrors>

关于asp.net - 如何: Dnn Custom Error Pages,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27730866/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com