A
Andy Fish
Hi,
I just thought someone reading this might be interested to know that I've
just decided to stop using server.transfer and replace it with
response.redirect instead.
The app had several places where you would click on a button, it would go
away and do something and take you to the next page. When I first started
using asp.net I was keen on server.transfer because it avoids an unnecessary
round trip to the browser. However, the downsides of this approach are:
1. URL as shown in the browser does not correspond to the page the user is
actually seeing.
2. if he refreshes the new page this has to be done by re-posting the
previous page. This may cause problems on the server if the action is not
idempotent, but at the very least will cause a warning from IE about having
to post
3. if the new page and old page are in different directories, any relative
references to external resources (e.g. <img src="../images/foo.gif">) in the
new page won't work because the URL seen by the browser is the old one
I realise that 2 and 3 are side-effects of 1. For my money, unless you want
to read the form values from the old page in the new one, you're better off
living with the extra network traffic and doing a redirect.
Andy
I just thought someone reading this might be interested to know that I've
just decided to stop using server.transfer and replace it with
response.redirect instead.
The app had several places where you would click on a button, it would go
away and do something and take you to the next page. When I first started
using asp.net I was keen on server.transfer because it avoids an unnecessary
round trip to the browser. However, the downsides of this approach are:
1. URL as shown in the browser does not correspond to the page the user is
actually seeing.
2. if he refreshes the new page this has to be done by re-posting the
previous page. This may cause problems on the server if the action is not
idempotent, but at the very least will cause a warning from IE about having
to post
3. if the new page and old page are in different directories, any relative
references to external resources (e.g. <img src="../images/foo.gif">) in the
new page won't work because the URL seen by the browser is the old one
I realise that 2 and 3 are side-effects of 1. For my money, unless you want
to read the form values from the old page in the new one, you're better off
living with the extra network traffic and doing a redirect.
Andy