每个区域不同的自定义错误页,我设计一个网站,有管理员的一个区域(经理)。在主要的网站我很容易在webconfig中定制错误页面。与此:如何显示ASP.NET MVC 5
<httpErrors errorMode="Custom" existingResponse="Replace" defaultResponseMode="ExecuteURL">
<remove statusCode="400"/>
<remove statusCode="401"/>
<remove statusCode="403"/>
<remove statusCode="404"/>
<remove statusCode="408"/>
<remove statusCode="409"/>
<remove statusCode="500"/>
<error statusCode="400" responseMode="ExecuteURL" path="/Error/400"/>
<error statusCode="401" responseMode="ExecuteURL" path="/Error/401"/>
<error statusCode="403" responseMode="ExecuteURL" path="/Error/403"/>
<error statusCode="404" responseMode="ExecuteURL" path="/Error/404"/>
<error statusCode="408" responseMode="ExecuteURL" path="/Error/408"/>
<error statusCode="409" responseMode="ExecuteURL" path="/Error/409"/>
<error statusCode="500" responseMode="ExecuteURL" path="/Error/500"/>
</httpErrors>
现在我想表明,在管理区一些不同的自定义错误页(就像他们的面板)的管理员。
有人可以告诉我,我该怎么办呢?
编辑: 我把一个新的web.config文件放在/Areas/Manager
文件夹中。
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<httpErrors errorMode="Custom" existingResponse="Replace" defaultResponseMode="ExecuteURL">
<remove statusCode="400"/>
<remove statusCode="401"/>
<remove statusCode="403"/>
<remove statusCode="404"/>
<remove statusCode="408"/>
<remove statusCode="409"/>
<remove statusCode="500"/>
<error statusCode="400" responseMode="ExecuteURL" path="/Manager/Error/400"/>
<error statusCode="401" responseMode="ExecuteURL" path="/Manager/Error/401"/>
<error statusCode="403" responseMode="ExecuteURL" path="/Manager/Error/403"/>
<error statusCode="404" responseMode="ExecuteURL" path="/Manager/Error/404"/>
<error statusCode="408" responseMode="ExecuteURL" path="/Manager/Error/408"/>
<error statusCode="409" responseMode="ExecuteURL" path="/Manager/Error/409"/>
<error statusCode="500" responseMode="ExecuteURL" path="/Manager/Error/500"/>
</httpErrors>
</system.webServer>
</configuration>
我甚至把httpErrors部分放在~/Areas/Manager/Views/web.config
。但总是因为错误我看到/Error/ErrorCode
而不是/Manager/Error/ErrorCode
页面。
是如何管理的404消息从客户404有什么不同?你能不能一起展示两个模型? – Win
在我的经理区域,我有一个管理面板(AdminLte)不同的菜单,边栏和页脚等,它们有一个完全不同的_Layout。 –