Session state created while response flushed....
-
Session state has created a session id, but cannot save it because the response was already flushed by the application.
I have a big problem with this error. Few days ago, web app worked fine and when session expired and I refreshed the page, code inside Session_Start in global.asax logs me in again.
cookie = Request.Cookies\["Userword"\]; if (cookie != null) { string strCookie = cookie.Value; if (strCookie != "") { sin.AutoLogin(cookie.Values\["heavy"\], cookie.Values\["metal"\], true, Request.UrlReferrer.AbsoluteUri == null ? "" : Request.UrlReferrer.AbsoluteUri, false); } } else { if (Session\["UserInfo"\] == null) { Response.Redirect("login.aspx"); } }
Yesterday I can't login by refreshing the page, any more. If I login manually, everything is ok. Error raises only when session expires and user refreshes the page. When I try to step in AutoLogin function, try catch block catches the Object reference error before debugger was able to step into a function. The above error I caught in Application_Error in global.asax. I have searched the net for solution, but with no luck. Most of the answers were that you shouldn't use Response.Flush and I have Response.Flush only in captcha class which is loaded on login.aspx page and everything worked great until yesterday. Can anyone help me with this issue?