Windows Auth Server cannot set status after sending HTTP headers

I have an application at n-level C #. In normal mode, we use forms authentication and everything works fine, but when we tried to install authentication on Windows, it started throwing the following exception in some cases (mainly in administration, for exaple, when you try to edit the request and client server for user details). doesn't happen at all in Internet Explorer. In Firefox and Chrome, he drops it every time.

System.Web.HttpException (0x80004005): Server cannot set status after HTTP headers have been sent. at System.Web.HttpResponse.set_StatusCode(Int32 value) at System.Web.HttpResponseWrapper.set_StatusCode(Int32 value) at System.Web.Mvc.HttpStatusCodeResult.ExecuteResult(ControllerContext context) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) 

Please, can you give me some tips on what could go wrong and how to fix it? Thanks

+4
source share
1 answer

Well, you need to look at your code and see where things are written to the output stream. Something writes out something before you set the status code, and ASP.NET will not allow this.

As for why this happens in FF and Chrome, do you have any code that tries to determine in which browser it sends different things to different browsers?

0
source

Source: https://habr.com/ru/post/1438419/


All Articles