ASP. NET page Jump Method 7

Source: Internet
Author: User

For the B/S Project, page Jump is normal and necessary. Let's take a look at ASP. NET page Jump, and a detailed explanation of the ha... \ (^ o ^ )/~

 

1. response. Redirect ("http://www.cnblogs.com/sukiwqy/", 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.
The response. Redirect method causes the browser to link to a specified URL. When the response. Redirect () method is called, it creates a response, which indicates
StatusCode302 (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. That is to say,
When the response. Redirect method is used, 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,

Get a 302 response, and the second request is the new page stated in the 302 response, get the page after redirection.

 

2. server. Transfer ("Default. Aspx? Name = wuqingyang ", 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, the server. 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
Tb310true, the form data and query string of the first page can be retained.
At the same time, when using server. Transfer, note that the target page will use the response stream created on the original page. As a result, ASP. NET machine verification checks that 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 ("Default. Aspx? Address = Guangzhou );

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.

Set the enableviewstatemac attribute of the page command to false.

 

4. response. Write ("<script language = 'javascript '> window. Open ('Default. 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 ='Default. Aspx '</SCRIPT> ");

Open a new page, and the original window is replaced.

 

6. response. Write ("<SCRIPT> window. showmodaldialog ('default. aspx ') </SCRIPT> ");

7. response. Write ("<SCRIPT> window. showmodelessdialog ('default. 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.
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 prevent a new window from popping up the hyperconnections between showmodaldialog and showmodelessdialog?
Add to the opened webpage. This sentence is generally placed between and

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.