Server cannot modify cookies after HTTP headers have been sent
问题 I am creating a web application in C#. When my page loads I fire an asynchronous thread to process some data. Part of this processing is the updating of a cookie. However when I save the cookie to the response by System.Web.HttpContext.Current.Response.Cookies.Add(cookie) , I get the following exception: HttpException: Server cannot modify cookies after HTTP headers have been sent. Any way I can work around or fix this? 回答1: Unless you have a very good reason to, you shouldn't be spinning up