我想从我的模块中抛出一个 404 file not found 异常,但是每个异常都被 DNN 捕获并且没有显示我的 404.aspx 页面(仅来自 DNN 的错误页面)。
在我的 web.config 中,我添加了:
<httpErrors errorMode="Custom" defaultResponseMode="File">
<remove statusCode="404" />
<error statusCode="404" prefixLanguageFilePath="" path="/404.aspx" responseMode="ExecuteURL" />
</httpErrors>
&
<customErrors mode="On">
<error statusCode="404" redirect="~/404.aspx" />
</customErrors>
打开不存在的页面时效果很好。但是尝试对我的模块做同样的事情并没有给我同样的结果......
我尝试了以下但没有成功:
throw new HttpException(404, "Not Found");