<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Migrating from ASP.NET 1.x to ASP.NET 2.0</title><link>http://forums.asp.net/180.aspx</link><description>Discuss issues about compatibility with and migration from previous versions of ASP.NET.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: Error :Session state has created a session id, but cannot save it because the response was already flushed by the application.</title><link>http://forums.asp.net/thread/1576342.aspx</link><pubDate>Tue, 13 Feb 2007 12:51:30 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1576342</guid><dc:creator>softer</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1576342.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=180&amp;PostID=1576342</wfw:commentRss><description>&lt;p&gt;That happens because sometimes (depending on the web.config configuration) the SessionID is not set in the cookie when Session_Srtart event executes in the global asax.&lt;/p&gt;
&lt;p&gt;You encounter this error because at somepoint in the pagelifecycle a variable is set in the session. After the request ends, ASP.NET tries to set the SessionID too, but if the Request was flused (eg. this can be done by Response.Write or AJAX itself flushes the response) this exception will be thrown.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;A simple fix would be (in the global.asax file):&lt;/p&gt;&lt;pre class="coloredcode"&gt; &lt;span class="kwd"&gt;void&lt;/span&gt; Session_Start(&lt;span class="kwd"&gt;object&lt;/span&gt; sender, EventArgs e) 
    {
&lt;span class="cmt"&gt;	// Code that runs when a new session is started

	//Ensure SessionID in order to prevent the folloing exception
	//when the Application Pool Recycles
	//[HttpException]: Session state has created a session id, but cannot 
	//				   save it because the response was already flushed by &lt;/span&gt;
	&lt;span class="kwd"&gt;string&lt;/span&gt; sessionId = Session.SessionID;
    }&lt;/pre&gt;&amp;nbsp;</description></item><item><title>Re: Error :Session state has created a session id, but cannot save it because the response was already flushed by the application.</title><link>http://forums.asp.net/thread/1576341.aspx</link><pubDate>Tue, 13 Feb 2007 12:51:11 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1576341</guid><dc:creator>softer</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1576341.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=180&amp;PostID=1576341</wfw:commentRss><description>&lt;p&gt;That happens because sometimes (depending on the web.config configuration) the SessionID is not set in the cookie when Session_Srtart event executes in the global asax.&lt;/p&gt;
&lt;p&gt;You encounter this error because at somepoint in the pagelifecycle a variable is set in the session. After the request ends, ASP.NET tries to set the SessionID too, but if the Request was flused (eg. this can be done by Response.Write or AJAX itself flushes the response) this exception will be thrown.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;A simple fix would be (in the global.asax file):&lt;/p&gt;&lt;pre class=coloredcode&gt; &lt;span class=kwd&gt;void&lt;/span&gt; Session_Start(&lt;span class=kwd&gt;object&lt;/span&gt; sender, EventArgs e) 
    {
&lt;span class=cmt&gt;	// Code that runs when a new session is started

	//Ensure SessionID in order to prevent the folloing exception
	//when the Application Pool Recycles
	//[HttpException]: Session state has created a session id, but cannot 
	//				   save it because the response was already flushed by &lt;/span&gt;
	&lt;span class=kwd&gt;string&lt;/span&gt; sessionId = Session.SessionID;
    }&lt;/pre&gt;&amp;nbsp;</description></item><item><title>Re: Error :Session state has created a session id, but cannot save it because the response was already flushed by the application.</title><link>http://forums.asp.net/thread/1500981.aspx</link><pubDate>Mon, 18 Dec 2006 18:53:33 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1500981</guid><dc:creator>doolaard</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1500981.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=180&amp;PostID=1500981</wfw:commentRss><description>No unfortunately no one came up with a solution. For now I i use this code within the 1.1 framwork where it works oke!!</description></item><item><title>Re: Error :Session state has created a session id, but cannot save it because the response was already flushed by the application.</title><link>http://forums.asp.net/thread/1477734.aspx</link><pubDate>Mon, 27 Nov 2006 16:38:07 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1477734</guid><dc:creator>CTGuy67</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1477734.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=180&amp;PostID=1477734</wfw:commentRss><description>You find a solution for this yet?&amp;nbsp; I'm getting this too, and I don't have a single flush statement in my projects.</description></item><item><title>Error :Session state has created a session id, but cannot save it because the response was already flushed by the application.</title><link>http://forums.asp.net/thread/1470802.aspx</link><pubDate>Mon, 20 Nov 2006 09:17:52 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:1470802</guid><dc:creator>doolaard</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/1470802.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=180&amp;PostID=1470802</wfw:commentRss><description>&lt;p&gt;Hello, we have a website that was developed under ASP.NET 1.1 and now we want to run it under ASP.NET 2.0. Since we cannot access the original code we placed it in a separate Application Pool and tested the site. Apparently all is oke, however every now and then the following problem:&lt;/p&gt;&lt;p&gt;&amp;nbsp;Exception message: Session state has created a
session id, but cannot save it because the response was already flushed
by the application.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;br /&gt;I researched the internet and found some possible solutions. One of them is not using Response.Flush(), but since we cannot access the source that isn't option.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Is there any other way to overcome this, please help us out!!&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Greetings,&lt;/p&gt;&lt;p&gt;Jan&lt;br /&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>