How do I exit the entire framework (frameset) in ASP, and return to the login screen?

Source: Internet
Author: User

Such as:

<frameset rows= "74,*,0,0" cols= "*" frameborder= "NO" border= "0" framespacing= "0" >
<frame src= "top.aspx" name= "Topframe" scrolling= "NO" Noresize >
<frameset cols= "200,*" frameborder= "NO" border= "0" framespacing= "0" >
<frame src= "left.aspx" name= "Leftframe" scrolling= "NO" noresize>
<frame src= "mainframe.aspx" name= "MainFrame" >
</frameset>

<noframes>

The simplest method:

1. Using background code

Response.Write ("<script> parent.window.location.href= ' default.aspx ' </script>");

2. Use the link

<a href= "javascript:parent.window.location.href=". /index.aspx '; " ><span> Sign Out </span></a>

Detailed Description:

  1. The following table lists information about some of the properties of the Window object.
  2. Property Method Description
  3. The opener open opener property is available only on pages that are opened by using the Window.Open method.
  4. Parent, top no parent and top properties are available for Windows that are open within a frame or IFRAME. These two properties return the immediate parent window and the topmost ancestor window, respectively.
  5. Parent, the top open parent and top properties are available for Windows opened by the Open method or opened in a dialog box and returned to the current window.
  6. Length no matter how the window is opened, the length property always returns the number of frames in the window.
  7. Dialogarguments, Dialogheight, Dialogleft, Dialogtop, dialogwidth, returnvalue ShowModalDialog and ShowModelessDialog
  8. The parent Gets the parents window in the object hierarchy.
  9. Top Gets the topmost ancestor window.
  10. ****************************************************************
  11. 1. Exit directly from the frames page and turn to the new window
  12. if (session["admin"] = =null)
  13. {
  14. Response.Write ("<script language=javascript>alert (' Login timeout, please re-login!!   ') </script> ");
  15. Response.Write ("<script language=javascript>top.location.href=").   /news/manager/login.aspx ' </script> ");
  16. }
  17. 2. If you need to close the current window in the frames page and open a new window
  18. 1) First prompt to close the current window and open a new window after you have determined to close the current window.
  19. if (session["admin"] = =null)
  20. {
  21. Response.Write ("<script language=javascript>alert (' Login timeout, please re-login!!   ') </script> ");
  22. Response.Write ("<script>window.parent.close (); window.open ('..           /news/manager/login.aspx ');</script> ");
  23. }
  24. The same effect:
  25. if (session["admin"] = =null)
  26. {
  27. Response.Write ("<script language=javascript>alert (' Login timeout, please re-login!!   ') </script> ");
  28. Response.Write ("<script>window.opener=null;top.window.close ();</script>");
  29. }
  30. 3. Close the current window in the frame without prompting. and open a new window
  31. if (session["admin"] = =null)
  32. {
  33. Response.Write ("<script language=javascript>alert (' Login timeout, please re-login!!   ') </script> ");
  34. Response.Write ("<script>window.open ('.          /news/manager/login.aspx '); Top.close ();</script> ");
  35. }
  36. if (session["admin"] = =null)
  37. {
  38. Response.Write ("<script language=javascript>alert (' Login timeout, please re-login!!   ') </script> ");
  39. Response.Write ("<script language=javascript>parent.location.href=").   /airquery/admin-manager/index.asp ' </script> ");
  40. Response.Write ("<script language=javascript>window.open (' ...   /airquery/admin-manager/index.asp '); Opener=null;top.close ();</script> ");
  41. }
  42. Window Properties:
  43. Opener Sets or gets a reference to the window that creates the current window.
  44. Self gets a reference to the current window or frame.
  45. Windown Method:
  46. Close closes the current browser window or HTML application (HTA).
  47. Open opens a new window and loads the document for the given URL.
  48. Briefly summarize:
  49. Either sentence can be done on the surface similar to the same effect.
  50. But the difference in actual effect:
  51. Response.Write ("<script language=javascript>parent.location.href=").   /airquery/admin-manager/index.asp ' </script> ");
  52. It is also possible to change the parent to top, without carefully studying why. Use it yourself. I am in my frame top,left.right (three frames right use without any problems)
  53. This is directly to the new page, but the address bar back can still be back, although the point back will be returned in the next, but as I above the wording, in the Page_Load, will again prompt "login timeout, please re-login" OK and then return. This effect, I am not very satisfied, so I came up with the following methods of use.
  54. Response.Write ("<script language=javascript>window.open (' ...   /airquery/admin-manager/index.asp '); Opener=null;top.close ();</script> ");
  55. What is the actual effect of this function? Very simple, after opening a new window, next, the original frame window is closed, note that the new window, then of course the back button becomes gray. The client is naturally unable to retreat. I prefer this effect. It fits my purpose (for example: Don't think about repeating submissions).
  56. In addition I add opener=null This sentence, is based on my understanding plus go, as if remove also can achieve the same effect. This can also be used if you change the top to parent. But if you change window.close () the Cue box is back. These are the results of the above version of IE6.0, other browsers have not tried.
  57. Small bet: When I look at the article, someone says, add onblur= "Self.close ()" to the window that needs to be closed,and then close the current window with the Window.close () method without prompting. But I can't even try on my machine!   It's unclear why!
  58. In addition, it is said that if the open () method opens a Subwindow, directly with Windown.close () or top.close () can be directly close the window, I tried, as if in this case, the body plus onblur="Self.close ( ), it is possible, but no test is added. To achieve my effect.   Make a simple record.

How do I exit the entire framework (frameset) in ASP, and return to the login screen?

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.