码迷,mamicode.com
首页 > Web开发 > 详细

异常System.Web.HttpException (0x80004005): Server cannot set status after HTTP headers have been sent.

时间:2014-07-19 15:28:41      阅读:508      评论:0      收藏:0      [点我收藏+]

标签:http   io   cti   代码   re   c   

在用mvc 的AuthorizeAttribute做身份验证,重写HandleUnauthorizedRequest方法,在Application_Error方法里出现异常System.Web.HttpException (0x80004005): Server cannot set status after HTTP headers have been sent。

 

反复尝试发现是在 protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)方法里这行代码引起的"Base.HandleUnauthorizedRequest(filterContext)"。删除该代码,发现在跳转前还是会执行Action里的其它方法。

改用: filterContext.Result = new RedirectResult(Common.GOMELONGINGURL);

一切正常。

异常System.Web.HttpException (0x80004005): Server cannot set status after HTTP headers have been sent.,布布扣,bubuko.com

异常System.Web.HttpException (0x80004005): Server cannot set status after HTTP headers have been sent.

标签:http   io   cti   代码   re   c   

原文地址:http://www.cnblogs.com/xuxu-dragon/p/3854125.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!