473,485 Members | 1,393 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Redirecting from site (Beta 2.0)

Hi

During certain periods I want all requests to my site to be redirected, the
only place I can see to do this is in the Session_Start event handler in the
global.asax file but when I try the following:

Session.Abandon();
Response.Redirect(http://www.site.com)

I get an error:

System.Web.HttpException: Session state has created a session id, but cannot
save it because the response was already flushed by the application.

at System.Web.SessionState.SessionIDManager.SaveSessi onID(HttpContext
context, String id, Boolean& redirected, Boolean& cookieAdded)

at System.Web.SessionState.SessionStateModule.CreateS essionId()

at System.Web.SessionState.SessionStateModule.Delayed GetSessionId()

at System.Web.SessionState.SessionStateModule.OnRelea seState(Object source,
EventArgs eventArgs)

at System.Web.SessionState.SessionStateModule.OnEndRe quest(Object source,
EventArgs eventArgs)

at
System.Web.HttpApplication.SyncEventExecutionStep. SystemWeb.HttpApplication.IExecutionStep.Execute()

at System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously)

Obviously I'm not approaching this the right way - any ideas?

Thanks

Kev
Nov 19 '05 #1
10 4287
Try Response.Clear() before

"Mantorok" <no**@tiscali.co.uk> schrieb im Newsbeitrag
news:dg**********@newsfeed.th.ifl.net...
Hi

During certain periods I want all requests to my site to be redirected,
the only place I can see to do this is in the Session_Start event handler
in the global.asax file but when I try the following:

Session.Abandon();
Response.Redirect(http://www.site.com)

I get an error:

System.Web.HttpException: Session state has created a session id, but
cannot save it because the response was already flushed by the
application.

at System.Web.SessionState.SessionIDManager.SaveSessi onID(HttpContext
context, String id, Boolean& redirected, Boolean& cookieAdded)

at System.Web.SessionState.SessionStateModule.CreateS essionId()

at System.Web.SessionState.SessionStateModule.Delayed GetSessionId()

at System.Web.SessionState.SessionStateModule.OnRelea seState(Object
source, EventArgs eventArgs)

at System.Web.SessionState.SessionStateModule.OnEndRe quest(Object source,
EventArgs eventArgs)

at
System.Web.HttpApplication.SyncEventExecutionStep. SystemWeb.HttpApplication.IExecutionStep.Execute()

at System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously)

Obviously I'm not approaching this the right way - any ideas?

Thanks

Kev

Nov 19 '05 #2
Tried that, now I'm getting this:

System.Web.HttpException: Session state has created a session id, but cannot
save it because the response was already flushed by the application.

Kev

"Alexander Widera" <aw**@hrz.tu-chemnitz.de.invalid.de> wrote in message
news:O%****************@tk2msftngp13.phx.gbl...
Try Response.Clear() before

"Mantorok" <no**@tiscali.co.uk> schrieb im Newsbeitrag
news:dg**********@newsfeed.th.ifl.net...
Hi

During certain periods I want all requests to my site to be redirected,
the only place I can see to do this is in the Session_Start event handler
in the global.asax file but when I try the following:

Session.Abandon();
Response.Redirect(http://www.site.com)

I get an error:

System.Web.HttpException: Session state has created a session id, but
cannot save it because the response was already flushed by the
application.

at System.Web.SessionState.SessionIDManager.SaveSessi onID(HttpContext
context, String id, Boolean& redirected, Boolean& cookieAdded)

at System.Web.SessionState.SessionStateModule.CreateS essionId()

at System.Web.SessionState.SessionStateModule.Delayed GetSessionId()

at System.Web.SessionState.SessionStateModule.OnRelea seState(Object
source, EventArgs eventArgs)

at System.Web.SessionState.SessionStateModule.OnEndRe quest(Object source,
EventArgs eventArgs)

at
System.Web.HttpApplication.SyncEventExecutionStep. SystemWeb.HttpApplication.IExecutionStep.Execute()

at System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously)

Obviously I'm not approaching this the right way - any ideas?

Thanks

Kev


Nov 19 '05 #3
And if you try:
Response.Buffer = true;

at the beginning?

"Mantorok" <no**@tiscali.co.uk> schrieb im Newsbeitrag
news:dg**********@newsfeed.th.ifl.net...
Tried that, now I'm getting this:

System.Web.HttpException: Session state has created a session id, but
cannot save it because the response was already flushed by the
application.

Kev

"Alexander Widera" <aw**@hrz.tu-chemnitz.de.invalid.de> wrote in message
news:O%****************@tk2msftngp13.phx.gbl...
Try Response.Clear() before

"Mantorok" <no**@tiscali.co.uk> schrieb im Newsbeitrag
news:dg**********@newsfeed.th.ifl.net...
Hi

During certain periods I want all requests to my site to be redirected,
the only place I can see to do this is in the Session_Start event
handler in the global.asax file but when I try the following:

Session.Abandon();
Response.Redirect(http://www.site.com)

I get an error:

System.Web.HttpException: Session state has created a session id, but
cannot save it because the response was already flushed by the
application.

at System.Web.SessionState.SessionIDManager.SaveSessi onID(HttpContext
context, String id, Boolean& redirected, Boolean& cookieAdded)

at System.Web.SessionState.SessionStateModule.CreateS essionId()

at System.Web.SessionState.SessionStateModule.Delayed GetSessionId()

at System.Web.SessionState.SessionStateModule.OnRelea seState(Object
source, EventArgs eventArgs)

at System.Web.SessionState.SessionStateModule.OnEndRe quest(Object
source, EventArgs eventArgs)

at
System.Web.HttpApplication.SyncEventExecutionStep. SystemWeb.HttpApplication.IExecutionStep.Execute()

at System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously)

Obviously I'm not approaching this the right way - any ideas?

Thanks

Kev



Nov 19 '05 #4
Same.

Kev

"Alexander Widera" <aw**@hrz.tu-chemnitz.de.invalid.de> wrote in message
news:%2*****************@tk2msftngp13.phx.gbl...
And if you try:
Response.Buffer = true;

at the beginning?

"Mantorok" <no**@tiscali.co.uk> schrieb im Newsbeitrag
news:dg**********@newsfeed.th.ifl.net...
Tried that, now I'm getting this:

System.Web.HttpException: Session state has created a session id, but
cannot save it because the response was already flushed by the
application.

Kev

"Alexander Widera" <aw**@hrz.tu-chemnitz.de.invalid.de> wrote in message
news:O%****************@tk2msftngp13.phx.gbl...
Try Response.Clear() before

"Mantorok" <no**@tiscali.co.uk> schrieb im Newsbeitrag
news:dg**********@newsfeed.th.ifl.net...
Hi

During certain periods I want all requests to my site to be redirected,
the only place I can see to do this is in the Session_Start event
handler in the global.asax file but when I try the following:

Session.Abandon();
Response.Redirect(http://www.site.com)

I get an error:

System.Web.HttpException: Session state has created a session id, but
cannot save it because the response was already flushed by the
application.

at System.Web.SessionState.SessionIDManager.SaveSessi onID(HttpContext
context, String id, Boolean& redirected, Boolean& cookieAdded)

at System.Web.SessionState.SessionStateModule.CreateS essionId()

at System.Web.SessionState.SessionStateModule.Delayed GetSessionId()

at System.Web.SessionState.SessionStateModule.OnRelea seState(Object
source, EventArgs eventArgs)

at System.Web.SessionState.SessionStateModule.OnEndRe quest(Object
source, EventArgs eventArgs)

at
System.Web.HttpApplication.SyncEventExecutionStep. SystemWeb.HttpApplication.IExecutionStep.Execute()

at System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously)

Obviously I'm not approaching this the right way - any ideas?

Thanks

Kev



Nov 19 '05 #5
have you other events in the global.asax?

"Mantorok" <no**@tiscali.co.uk> schrieb im Newsbeitrag
news:dg**********@newsfeed.th.ifl.net...
Same.

Kev

"Alexander Widera" <aw**@hrz.tu-chemnitz.de.invalid.de> wrote in message
news:%2*****************@tk2msftngp13.phx.gbl...
And if you try:
Response.Buffer = true;

at the beginning?

"Mantorok" <no**@tiscali.co.uk> schrieb im Newsbeitrag
news:dg**********@newsfeed.th.ifl.net...
Tried that, now I'm getting this:

System.Web.HttpException: Session state has created a session id, but
cannot save it because the response was already flushed by the
application.

Kev

"Alexander Widera" <aw**@hrz.tu-chemnitz.de.invalid.de> wrote in message news:O%****************@tk2msftngp13.phx.gbl...
Try Response.Clear() before

"Mantorok" <no**@tiscali.co.uk> schrieb im Newsbeitrag
news:dg**********@newsfeed.th.ifl.net...
> Hi
>
> During certain periods I want all requests to my site to be
> redirected, the only place I can see to do this is in the
> Session_Start event handler in the global.asax file but when I try the> following:
>
> Session.Abandon();
> Response.Redirect(http://www.site.com)
>
> I get an error:
>
> System.Web.HttpException: Session state has created a session id, but> cannot save it because the response was already flushed by the
> application.
>
> at System.Web.SessionState.SessionIDManager.SaveSessi onID(HttpContext> context, String id, Boolean& redirected, Boolean& cookieAdded)
>
> at System.Web.SessionState.SessionStateModule.CreateS essionId()
>
> at System.Web.SessionState.SessionStateModule.Delayed GetSessionId()
>
> at System.Web.SessionState.SessionStateModule.OnRelea seState(Object
> source, EventArgs eventArgs)
>
> at System.Web.SessionState.SessionStateModule.OnEndRe quest(Object
> source, EventArgs eventArgs)
>
> at
> System.Web.HttpApplication.SyncEventExecutionStep. SystemWeb.HttpApplicatio
n.IExecutionStep.Execute()>
> at System.Web.HttpApplication.ExecuteStep(IExecutionS tep step,
> Boolean& completedSynchronously)
>
>
>
> Obviously I'm not approaching this the right way - any ideas?
>
> Thanks
>
> Kev
>
>




Nov 19 '05 #6
I have:

App_Start
App_End
Session_Start
Session_End
App_Error

Kev

"Alexander Widera" <aw**@hrz.tu-chemnitz.de.invalid.de> wrote in message
news:ug****************@TK2MSFTNGP14.phx.gbl...
have you other events in the global.asax?

"Mantorok" <no**@tiscali.co.uk> schrieb im Newsbeitrag
news:dg**********@newsfeed.th.ifl.net...
Same.

Kev

"Alexander Widera" <aw**@hrz.tu-chemnitz.de.invalid.de> wrote in message
news:%2*****************@tk2msftngp13.phx.gbl...
And if you try:
Response.Buffer = true;

at the beginning?

"Mantorok" <no**@tiscali.co.uk> schrieb im Newsbeitrag
news:dg**********@newsfeed.th.ifl.net...
Tried that, now I'm getting this:

System.Web.HttpException: Session state has created a session id, but
cannot save it because the response was already flushed by the
application.

Kev

"Alexander Widera" <aw**@hrz.tu-chemnitz.de.invalid.de> wrote in message news:O%****************@tk2msftngp13.phx.gbl...
> Try Response.Clear() before
>
> "Mantorok" <no**@tiscali.co.uk> schrieb im Newsbeitrag
> news:dg**********@newsfeed.th.ifl.net...
>> Hi
>>
>> During certain periods I want all requests to my site to be
>> redirected, the only place I can see to do this is in the
>> Session_Start event handler in the global.asax file but when I try the>> following:
>>
>> Session.Abandon();
>> Response.Redirect(http://www.site.com)
>>
>> I get an error:
>>
>> System.Web.HttpException: Session state has created a session id, but>> cannot save it because the response was already flushed by the
>> application.
>>
>> at System.Web.SessionState.SessionIDManager.SaveSessi onID(HttpContext>> context, String id, Boolean& redirected, Boolean& cookieAdded)
>>
>> at System.Web.SessionState.SessionStateModule.CreateS essionId()
>>
>> at System.Web.SessionState.SessionStateModule.Delayed GetSessionId()
>>
>> at System.Web.SessionState.SessionStateModule.OnRelea seState(Object
>> source, EventArgs eventArgs)
>>
>> at System.Web.SessionState.SessionStateModule.OnEndRe quest(Object
>> source, EventArgs eventArgs)
>>
>> at
>> System.Web.HttpApplication.SyncEventExecutionStep. SystemWeb.HttpApplicatio
n.IExecutionStep.Execute()>>
>> at System.Web.HttpApplication.ExecuteStep(IExecutionS tep step,
>> Boolean& completedSynchronously)
>>
>>
>>
>> Obviously I'm not approaching this the right way - any ideas?
>>
>> Thanks
>>
>> Kev
>>
>>
>
>



Nov 19 '05 #7
Mantorok wrote:
Hi

During certain periods I want all requests to my site to be
redirected, the only place I can see to do this is in the
Session_Start event handler in the global.asax file but when I try
the following:
Session.Abandon();
Response.Redirect(http://www.site.com)

I get an error:

System.Web.HttpException: Session state has created a session id, but
cannot save it because the response was already flushed by the
application.


Maybe you need here a
Response.Redirect(http://www.site.com, false);

Or else, don't use Session_Start, but Application_BeginRequest.

Are you sure you *need* that Session.Abandon()?

Hans Kesting
Nov 19 '05 #8

"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:uA**************@TK2MSFTNGP14.phx.gbl...
Mantorok wrote:
Hi

During certain periods I want all requests to my site to be
redirected, the only place I can see to do this is in the
Session_Start event handler in the global.asax file but when I try
the following:
Session.Abandon();
Response.Redirect(http://www.site.com)

I get an error:

System.Web.HttpException: Session state has created a session id, but
cannot save it because the response was already flushed by the
application.


Maybe you need here a
Response.Redirect(http://www.site.com, false);

Or else, don't use Session_Start, but Application_BeginRequest.

Are you sure you *need* that Session.Abandon()?


In Beta 2 there is BeginRequest - that's why I'm pulling my hair out lol.

Kev
Nov 19 '05 #9

"Mantorok" <no**@tiscali.co.uk> wrote in message
news:dg**********@newsfeed.th.ifl.net...

"Hans Kesting" <ne***********@spamgourmet.com> wrote in message
news:uA**************@TK2MSFTNGP14.phx.gbl...
Mantorok wrote:
Hi

During certain periods I want all requests to my site to be
redirected, the only place I can see to do this is in the
Session_Start event handler in the global.asax file but when I try
the following:
Session.Abandon();
Response.Redirect(http://www.site.com)

I get an error:

System.Web.HttpException: Session state has created a session id, but
cannot save it because the response was already flushed by the
application.


Maybe you need here a
Response.Redirect(http://www.site.com, false);


Aha, I just tried that and I get no error now - thank you.

Kev
Nov 19 '05 #10
the default behavior of Response.Redirect is the write the redirct header,
then kill the thread. this is an easy way to stop page processing and the
html output it would generate. killing the thread in Session_Start is not a
good idea, because it too early in the page processing cycle.

you should Redirect(url,false), so the thread is not killed. you then have
to remenber this and stop page processing at a better time.

-- bruce (sqlwork.com)

"Mantorok" <no**@tiscali.co.uk> wrote in message
news:dg**********@newsfeed.th.ifl.net...
Hi

During certain periods I want all requests to my site to be redirected,
the only place I can see to do this is in the Session_Start event handler
in the global.asax file but when I try the following:

Session.Abandon();
Response.Redirect(http://www.site.com)

I get an error:

System.Web.HttpException: Session state has created a session id, but
cannot save it because the response was already flushed by the
application.

at System.Web.SessionState.SessionIDManager.SaveSessi onID(HttpContext
context, String id, Boolean& redirected, Boolean& cookieAdded)

at System.Web.SessionState.SessionStateModule.CreateS essionId()

at System.Web.SessionState.SessionStateModule.Delayed GetSessionId()

at System.Web.SessionState.SessionStateModule.OnRelea seState(Object
source, EventArgs eventArgs)

at System.Web.SessionState.SessionStateModule.OnEndRe quest(Object source,
EventArgs eventArgs)

at
System.Web.HttpApplication.SyncEventExecutionStep. SystemWeb.HttpApplication.IExecutionStep.Execute()

at System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously)

Obviously I'm not approaching this the right way - any ideas?

Thanks

Kev

Nov 19 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5999
by: Agoston Bejo | last post by:
Hi, how can one redirect std::cerr into a file? Specifically, if I have an ofstream object, is there something I can do to make "cerr << ..." calls write into that particular ofstream object? ...
1
3099
by: Gurikar | last post by:
How to redirect information to file usinf cerr or clog. Regards
7
1158
by: Tom Szabo | last post by:
Hi All, What I want to achieve is to display a login screen in a certain size and appearance window with no toolbars etc. To achieve this I think I need to use redirection, but I am not sure...
5
12756
by: vijaynats | last post by:
Hi I created a windows app to run a dos batch file (which takes around 5mins to complete and generates lots of output messages on the console in the meantime)and i used RedirectStandardOuput to...
0
2115
by: Sune Hansen | last post by:
Hi guys, I really hope someone can help me with my problem. Here is the scenario: I have a development environment on my locale machine. Once in a while when everything has been tested I...
4
1480
by: Greg Smalter | last post by:
Redirecting from page to page within a web project is pretty easy. However, all Redirect methods take strings as arguments, as if you mistype the string, you don't find out until run time that you...
5
1675
by: Bendik Engebretsen | last post by:
Developed this personal WEB site with the new ASP.NET 2.0 Beta: http://www.techsoft.no/bendik/ It has got this problem: After a while browsing through pictures on the site, an error occurs: ...
0
934
by: John Bailey | last post by:
Okay, I have the Visual Studio 2005 Release Candidate, and it is a great improvement over Beta 2. My ISP hasn't decided when they will support the RC, so they are still on Beta 2. I can for the...
3
5934
by: =?Utf-8?B?c3VyZXNocGFuZGk=?= | last post by:
Hi I am in a web site A. I want to redirect to a web site B with basic authentication. HttpWebContext and WebRespose methods are downloading a site page as html and this is not helping me. I...
0
7116
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7161
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7275
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4857
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4551
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3058
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3063
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1376
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
595
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.