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

在用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.

上一篇:PHP开发环境的搭建


下一篇:TIBCO Jaspersoft Studio-6.12.2连接mysql时显示时区问题