2016-04-26 108 views
0

在我的web配置我有這樣的設置:ASPNET HttpErrors重定向到控制器

<httpErrors errorMode="Custom" defaultPath="/Error/Error/ErrorHandler/404" defaultResponseMode="ExecuteURL" /> 

我想重定向所有IIS錯誤去我自己的控制器和行動。但是我得到的錯誤:

The requested page cannot be accessed because the related configuration data for the page is invalid.

但是,如果我嘗試特定的錯誤代碼重定向到我的控制器,它會工作。例如:

<httpErrors errorMode="Custom" > 
     <remove statusCode="403"/> 
     <error statusCode="403" responseMode="ExecuteURL" path="/Error/Error/ErrorHandler/404"/> 
    </httpErrors> 

如何更改我的默認重定向以轉到我的控制器/操作?

+0

曾嘗試閱讀本http://stackoverflow.com/questions/9216158/the-requested-page-cannot-be-accessed-because-關聯配置數據爲 – jamiedanq

+0

@jamiedanq是的,我做了,這不是我的問題 –

回答