如何在MVC中管理多个自定义错误页面? [英] How to manage multiple custom error page in MVC?
问题描述
我正在新闻门户网站上工作。此应用程序有两个部分用户部分和管理部分。
在用户部分,我使用以下方法解析并显示自定义错误页面,因为如果url /找不到页面页面找不到任何页面。
< system.web>
< customerrors mode =Ondefaultredirect = Error1>
< error statuscode =404redirect =〜/ User / NoPageFound>
工作正常。
在管理部分,如果找不到网址/页面,则在上面页面显示。
但是我想显示我的其他错误页面在下面的应用程序中哪个位置不同:
〜/ Admin / NoPageFound
我已经尝试过很多次却失败了。
如何显示我的上述要求?
如果可能,请解决此问题。
我尝试过:
请resol如果可能的话,这个问题。
I am working on news portal. This application have two section user section and admin section.
In user section, I am using following method to resolve and show custom error page as page not found if url/page not found any page.
<system.web>
<customerrors mode="On" defaultredirect="Error1">
<error statuscode="404" redirect="~/User/NoPageFound">
It works fine.
In admin section, If url/page is not found then above page is shown.
But I want to show my other error page which location as different in application like below:
"~/Admin/NoPageFound"
I have tried so many times but failed.
How to show my above requirement?
Please resolve this issue if possible.
What I have tried:
Please resolve this issue if possible.
推荐答案
阅读 - 显示自定义错误页面(C#)| ASP.NET站点 [ ^ ]。
这篇关于如何在MVC中管理多个自定义错误页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!