1
votes

What are the differences between PostBackUrl,Response.Redirect and Server.Transfer? What method we need to follow in which situations?

1

1 Answers

4
votes

PostbackUrl changes form's action attribute, so initial page is not changed, but when user posts the form, it's data being sent to the different page.

Response.Redirect leads to HTTP 302 Redirect. It is the common redirect action unlike 301 redirect which is used when you want to change the url completely and permanently.

Server.Transfer in fact does not activates any HTTP requests and completely transparent to user. Usually it is used to show error pages (e.g. 404 or 500 HTTP statuses), because if you will use redirect instead of Server.Transfer, browser (more important if it's a search engine crawler) will not receive original HTTP status (404 for example).