.NET 2.0 SP2 breaks Response.Redirect behavior ?

A

Alessandro C.

Here is the issue I've found:
-
- there is an HTTPModule which subscribes the
Application.PostRequestHandlerExecute
- During the request processing a Response.Redirect("somewhere.aspx", true)
is executed.

The project has been created using VS2005 on .NET 2.0 without SPs.

In the first implementation the code in the PostRequestHandlerExecute
handler is always run.
Then after having installed VS2008, the handler is no more called. After
some investigation I'ev found that VS2008 installed .net 2.0 SP2 and this
seems to be the problem.

I googled the problem but found nothing. So here I am.

Do you have please any suggestion about this problem?
Thank you in advance.

Alessandro
 
C

Coskun Sunali [MVP]

Hi Alessandro,

You are ending the response by setting the 2nd parameter to true. Did you
have a chance to try it by setting it to false?
 
A

Alessandro C.

Hi Coskuni, thank you for your response.

Of course if I set the 2nd parameter to false in the Response.Redirect call,
the PostRequestHandlerExecute is called by the framework. My point is: when
you set the 2nd parameter to true, why there exist different behaviors
between having SP2 or not having SP? It seems that SP2 had somehow
interfered with the Request process pipeline and I don't know why and how.
Please note that my question is not an accademic one; I inherited the
management of a site in production and I want to be 100% sure of what impact
this issue can have on the system.

Besides, I assume the 'old' behavior (the one with no SPs) is incorrect,
because in effect the PostRequestHandlerExecute is called after a redirect
which should end the Response. is my assumption correct? If yes, I assume
that SP2 fix this (maybe SP1 has already done that) incorrect behavior. If my
assumption is correct, I think I can find some info from msdn about that fix,
but I wasn't able.

Thank you very much for your attention
Alessandro C.

P.S.: I hope my english will work :)
 
C

Coskun Sunali [MVP]

Hi Alessandro,

I am not aware of such an official change. However, I know that a
"ThreadAbortException" is being thrown in case you end the response with a
"true" parameter being set as the 2nd parameter of Response.Redirect. I just
found a knowledge base article saying that ASP.NET shifts the execution to
the Application_EndRequest if you do not catch this exception. To me, this
means that it is normal that PostRequestHandlerExecute is not being executed
in your case. And yes, again "to me", this means that there was a problem in
previous versions of .NET Framework and it has been fixed in SP2 according
to the information you gave me.

http://support.microsoft.com/kb/312629

Please let me know if I can be of any further assistance.


--
Coskun Sunali
Microsoft MVP - ASP.NET
http://sunali.com
http://propeople.dk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,738
Latest member
JinaMacvit

Latest Threads

Top