1. Use traditional response. Redirect
For example
String url = "/account/create ";
Response. Redirect (URL );
1. server. Transfer Method:
Server. Transfer ("m2.aspx"); // page redirection (executed on the server ). The server stops parsing this page, saves the data on this page, redirects the page to m2.aspx, and returns the result of adding the m2.aspx page to the browser.
2. server. Execute method:
Server. execute ("m2.aspx"); after the server saves the data from this page to the previous one, It redirects the page to m2.aspx for execution, and then returns to this page for further execution. merge the three results and return them to the browser.
All of the above are server-side page redirection, so there is no page change record in the browser (the displayed address will not change ). Therefore, if you refresh this page, there may be some other unexpected situations. This type of page redirection can complete some other functions, such as accessing the server control on the previous page.
3. response. Redirect:
When a browser requests An ASPX page, the Redirect (URL) method is used to tell the browser that you need to access a page first, so the browser then sends a request to the server. Relocation is performed through the browser, and an additional round-trip between the server and the browser will be generated. When the network condition is not good, the two requests will greatly reduce the applicationProgramOr even occupy excessive bandwidth.
In summary, the Redirect (URL) method is the most efficient when the network status is good !! The server. Transfer Method and server. Execute method are the most flexible !! The server. Execute method occupies the most resources.
2. use the new redirecttoaction ("action name", "Controller name") of MVC;
return redirecttoaction ("Index", "home"); // jump to the homepage.
the first parameter is the action name, the second parameter is the Controller name, and the method returns an actionresult. That is, the returned view.