ASP. NET Framework page Jump: window. location. href usage

Source: Internet
Author: User

Write ASP. net program, we often encounter page Jump problems, we often use Response. redirect for ASP. NET Framework page Jump, if the customer wants to use the prompt when the jump, this is not a good thing, such:

 
 
  1. Response. Write ("< Script>Alert ('Congratulations, registration successful! ');</Script>");
  2. Response. Redirect ("main.html "); 

At this time, our prompt content will jump without coming out, and there is no difference with Response. Redirect ("main.html.

Then we use the following code to test:

Another implementation of ASP. NET Framework page Jump

 
 
  1. Response. Write ("< Script Language=Javascript>Alert ('Congratulations, registration successful! ')</Script>");
  2. Response. Write ("< Script Language=Javascript>Window. location. href='Main.html'</Script>");

This allows us to jump to the page after the prompt.

The most important thing is that the window. location. href statement can implement a framework page, refresh the page of another framework after executing the server code (Response. Redirect cannot be reached, at least I did not find it ):

For example, the index.htm page has two frameworks: frameLeft and frameRight. On the frameRight page, execute the server code and refresh the page in frameLeft.

Previously, the most common issue was to automatically refresh the login box after registration and change the login box to the logged-on page. You only need to add a section after the successfully registered code, that is, you can refresh the page of another framework. The Code is as follows:

 
 
  1. Response. Write ("< Script Language=Javascript>Alert ('Congratulations, registration successful! ')</Script>");
  2. Response. Write ("< Script Language=Javascript>Window. parent. frameLeft. location. href='Main.html'</Script>");

In this way, the ASP. NET Framework page Jump interruption is solved.

  1. Web Resources Management model provided by ASP. NET 2.0
  2. ASP. NET Server custom control security guidelines
  3. Analysis of ASP. NET programming standards and Their encoding specifications
  4. Introduction to ASP. NET sessions
  5. ASP. NET programming tool ASP. NET Web Matrix

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.