PostBackUrl Vs Response.Redirect

前端 未结 1 773
别那么骄傲
别那么骄傲 2021-01-23 11:53

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

相关标签:
1条回答
  • 2021-01-23 12:12

    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).

    0 讨论(0)
提交回复
热议问题