0

I have a custom rewrite module and when specific query string parameters are passed i need to be able to call a server.transfer and not a response.redirect due to adserve software and tracking

in the Init Event of the RewriteModule i register the events:

BeginRequest PreRequestHandlerExecute ReleaseRequestState

when a Response.Redirect is called the ReleaseRequestState event is actually called and the rewrite module is complete and the new control URL's are set

when a Server.Transfer is called then the ReleaseRequestState event is not called and the friendly URL's are not set

i think i understand the different between a Response.Redirect and Server.Transfer but i cannot work out why the event is actually not called - is the Session.End or Session.Abandon event being called and this the event is never fired? or is something completely different happening here

thanks

paul

stack72
  • 8,198
  • 1
  • 31
  • 35

1 Answers1

0

I'm guessing it's the subtle differences between the two.

Response.Redirect does a client-side redirect -- meaning the client browser is sent a message telling it to request a different URL and therefore giving you a new request.

Server.Transfer doesn't create a new request (http://msdn.microsoft.com/en-us/library/y4k58xk7.aspx). It just stops working on the current page and begins work on another page -- no new request.

PatrickSteele
  • 14,489
  • 2
  • 51
  • 54
  • Hi thanks for getting back to me - if there is no new request then surely it would then continue to call the PostReleaseState eventrather than just killing the request? – stack72 Jul 26 '10 at 12:54
  • Seems like it should. Unless there's some magic going on inside the pipeline to know whether state was acquired. If no state was acquired (like for a .css request), maybe the framework doesn't call the ReleaseRequestState. Just conjecture though -- I don't know this for a fact. – PatrickSteele Jul 26 '10 at 13:08