2012-10-03 46 views
0

我有這樣的事情:獲取錯誤信息重定向錯誤頁面

public ActionResult Index(int id) 
{ 
    if (UserHasPermission()) 
    { 
     return View() 
    } 

    throw new HttpException(403, "You do not have permission"); 
} 

,在我的web.config我設置:

<customErrors mode="On"> 
    <error statusCode="403" redirect="/Error/403" /> 
</customErrors> 

我想知道如何得到這個當重定向到Error/403時消息'你沒有權限'。

回答