仅对MVC中的给定区域禁用customErrors

时间:2015-04-24 13:00:35

标签: asp.net-mvc-5 custom-errors

我在我的SELECT user_id FROM tbl_login WHERE username = '$username' AND password = 'password'; 网络应用程序中启用了beforeModel : function(){ var self = this; var touchpointId = window.location.href.split('hot-topics/'); return Ember.$.get('someUrl') .done(function(data){ self.controllerFor('hot-topics').set('defaultPeriod', data.hotTopicConfig[0].defaultPeriod); }); }, hotTopics : self.store.findQuery('hot-topic', { touchpointId : params.touchpointId, periodType : self.controllerFor('hot-topics').get('defaultPeriod') }).then(function(results){ return results.get('firstObject'); }) ,如下所示。

customErrors

我有区域定义名为" Admin"我需要为该特定区域关闭MVC5

我尝试在Areas文件夹中添加以下代码的web.config文件。

<customErrors defaultRedirect="/Error/InternalServerError" mode="On">
  <error redirect="/Error/NotFound" statusCode="404" />
  <error redirect="/Error/InternalServerError" statusCode="500" />
</customErrors>

但仍然显示我的自定义错误,如何仅针对MVC5中的给定区域禁用customErrors

1 个答案:

答案 0 :(得分:0)

将customErrors包装在 root web.config中的位置标记中:

  <location path="areaName">
      <system.web>
        <customErrors mode="Off" />
      </system.web>
  </location>