Asp. Net page Jump method and JS jump Method

Source: Internet
Author: User
<A> Tag1. <a href = "test. aspx"> </a> 2. This is the most common method of steering; HyperLink Widget 1.Asp.net server-side control property navigateurl specifies the URL address to jump 2.Navigateurl can be modified using code on the server, which is different from <A> 3.Hyperlink itself has no event, so you need to set navigateurl4in other events on the server. Sample Code <asp: hyperlink id = "HYPERLINK" runat = "server" navigatoeurl = "test. aspx "> OK </ASP: hyperlink> Response. Redirect () Method 1. Process: Send an HTTP Response to the client, notify the client to jump to a new page, and then the client sends a jump request to the server. 2.After the page jumps, all information saved by the internal control is lost. When a jumps to B, B cannot access the data submitted on page. 3.Use this method to jump to the browser and then change the URL Information in the address bar. 4.You can use session cookies and other objects to transmit data between pages. 5.The redirection operation occurs on the client and involves two communications with the web server in total: one is the request to the original page, and the other is the request to redirect the new page. Server. Transfer () Method1. when the page is redirected, the control of the page is handed over. 2. the stored information such as Request Session remains unchanged during page Jump. After the jump, you can use the data submitted on the previous page. 3. after the jump, the Url in the browser's Address Bar remains unchanged 4. the redirection request of this method is carried out on the server. The browser does not know that the page has already been redirected once. Server. Execute () Method 1.This method allows the current page to execute another page on the same Web server 2.After the page is executed, return to the location where the original page sends Server. Execute. 3.This method is similar to calling the requested page by the callback function for the page. You can use the form data of the original page and query the string set. 4.Set the EnableViewStateMac attribute of the Page command to False JavaScript string str = "<script language = javascript> history. go (-2); </script> ";
Response. Write (str ); Topic related:1. response is recommended to ensure the validity of HTML output. redirect method; because Server. execute or Server. the Transfer method returns multiple <Html> <body> tags to the client's page, which is not a legal HTML page and may cause errors in non-ie browsers. 2. Because Server. Transfer executes redirection on the Server side, it avoids unnecessary network communication and achieves better performance and browsing performance. Js jump page<Script language = "javascript" type = "text/javascript">
Window. location. href = "login. jsp? Backurl = "+ window. location. href;
</Script>

Second:
<Script language = "javascript">
Alert ("return ");
Window. history. back (-1 );
</Script>

Third:
<Script language = "javascript">
Window. navigate ("top. jsp ");
</Script>

Fourth:
<Script language = "JavaScript">
Self.location+'top.htm ';
</Script>

Category 5:
<Script language = "javascript">
Alert ("illegal access! ");
Top. location = 'xx. jsp ';
</Script>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.