C #7 Ways to jump to a webpage,

Source: Internet
Author: User

C #7 Ways to jump to a webpage,

1. Response. Redirect (http://www.baidu.com, false );The target page and the original page can be on two servers. You can enter the URL or relative path. The value of bool is whether to stop executing the current page. Jump to the new page, the original window is replaced. "The URL in the browser is a new path. : Response. Redirect method causes the browser to link to a specified URL. When the Response. Redirect () method is called, it creates a Response. The Response header indicates the status code 302 (indicating that the target has changed) and the new target URL. The browser receives the response from the server and sends a request to the new URL using the information in the response header. This means that Response is used. in the Redirect method, the redirection operation occurs on the client, involving two communications with the server (two back and forth) in total: the first request to the original page, and a 302 response is obtained, the second is the new page stated in the 302 response to the request, and the page after the redirection is obtained.

2. Server. Transfer ("Default2.aspx? Name = zhangan ", true );The target page and the original page can be on the same server. Jump to the new page, the original window is replaced. The URL in the browser of the popball Forum remains the same as the original path. By default, Server. the Transfer method does not pass form data or query strings from one page to another, but you only need to set the second parameter of this method to Tb310True, the form data and query string of the first page can be retained. At the same time, use Server. note that the target page will use the response stream created on the original page, which leads to ASP. NET machine verification check b310, Bo Qiu, Bo qiu.com, experts, game recommendations, event analysis, database, football events, basketball, NBA, odds, score, basketball data, football data.
(Machine Authentication Check, MAC) The ViewState of the new page has been tampered. Therefore, to retain the form data and query string set of the original Page, you must set the EnableViewStateMac attribute of the target Page command to False.

3. Server. Execute ("Default5.aspx? Address = beijing );The target page and the original page can be on the same server. Jump to the new page, and then jump to the original page. The URL in the browser remains the same as the original path. When the specified ASPX page is executed, the control process returns to the location where the original page is called by Server. Execute. This page navigation method is similar to calling the callback function for the ASPX page. The called page can access the form data and query string set of the calling page, therefore, set the EnableViewStateMac attribute of the called Page command to False.

4. Response. Write ("<script language = 'javascript '> window. open ('aaa. aspx'); </script> ");_The target page and the original page can be on two servers. You can enter the URL or relative path. The original window is retained, and a new page is added.

5. Response. Write ("<script language = 'javascript '> window. location = 'default2. aspx' </script> ");Open a new page, and the original window is replaced.

6. Response. Write ("<script> window. showModalDialog ('default2. aspx ') </script> ");

7. Response. Write ("<script> window. showModelessDialog ('default2. aspx ') </script> ");

(1) What are the differences between showModalDialog and showModelessDialog? ShowModalDialog: after being opened, the input focus is always maintained. You cannot switch to the main window unless the dialog box is closed. Similar to the running effect of alert. B310, Bo Qiu, Bo qiu.com, experts, event recommendation, event analysis, database, football events, basketball, NBA, odds, score, basketball data, football data showModelessDialog: after opening, you can randomly switch the input focus. It has no effect on the main window (it can be blocked at most. : P)

(2) How can we avoid a new window in the hyperconnection between showModalDialog and showModelessDialog? Add <base target = "_ self"> to the opened webpage. This sentence is generally placed between

Related Article

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.