BUG: InfoViewer Becomes Inoperable After Window.Close Is Called

Last reviewed: December 15, 1997
Article ID: Q178039
The information in this article applies to:
  • Microsoft Visual InterDev, version 1.0

SYMPTOMS

InfoViewer ceases to function after browsing a page with client-side script that contains the Window.Close command. Trying to browse other pages with InfoViewer causes a blank error message to appear.

CAUSE

InfoViewer is not capable of closing itself from within the Visual Studio shell. The conditions that cause this behavior are:

  • Client Side Script using the "Window.Close" command.
  • Browsing within the InfoViewer.

RESOLUTION

Use Internet Explorer to view the page that calls the "window.close" method.

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Steps to Reproduce Behavior

  1. Add a new .htm file to an existing Visual InterDev project. Name the file "test.htm."

  2. Copy the following code and paste it into the file created in the previous step:

          <INPUT TYPE="button" NAME="Button1" VALUE="Close Window"
          onClick="window.close()">
    

  3. Save the file.

  4. Preview the file above in the InfoViewer. If you don't have "InfoViewer" set as your default browser within Visual InterDev, right-click the file in the "FileView" pane and then, from the context menu, select "Browse With" and then "InfoViewer."

<<<CONTENTNUM>>> 178037 <<<CONTENTTYPEID>>> 1 <<<TITLE>>> PRB: Session Variables Lost When ASP Is Located in Frameset <<<LONGTITLE>>> PRB: Session Variables Lost When ASP Is Located in Frameset <<<PRODUCT>>> axsf <<<PRIORITY>>> 1 <<<SECURITY>>> PUBLIC <<<AUTHOR>>> kerryr <<<EDITOR>>> lmoloney <<<EDITSTATUS>>> Released <<<TECH>>> KERRYR <<<TECHSTATUS>>> Approved <<<EXPIREDATE>>> Dec 31 1999 12:00AM <<<MESSAGE>>> Initial edit by pjriker 12/12/97 <<<KEYWORD>>> VIASP <<<INTERNALADMIN>>> kbDSupport kbdsi <<<QUESTION>>> <<<PRODVERNUM>>> WINNT:1.0,1.0b <<<COMPONENT>>> <<<TECHNOLOGY>>> <<<LINKS>>> <<<RAIDINFO>>> <<<INCIDENT>>> <<<SWEEPDATE>>> <<<SWEEPSTATUS>>> <<<SOLUTIONTYPE>>> <<<ISSUETYPE>>> kbprb <<<PLATFORM>>> winnt <<<HARDWARE>>> <<<BOILERPLATE>>> <<<PRODUCEDVIEW>>> <<<TEXT>>> The information in this article applies to:
  • Microsoft Active Server Pages, versions 1.0, 1.0b

SYMPTOMS

Values of session variables defined in an Active Server Pages (ASP) page are empty when you attempt to access the values from other ASP pages within the frameset.

CAUSE

The following conditions cause this error to occur:

  • Session variables initialized within the ASP file, as opposed to being initialized in the global.asa. (See NOTE 1 below.)

        -and-
    
  • The ASP files in condition 1 above are loaded into a frameset.

When displaying ASP files within a frameset, a new session is started for each ASP file contained within the frameset. Likewise, the Session_OnStart subroutine is called once for each ASP file.

Active Server Pages keeps track of sessions through the use of cookies. When using a frameset that contains ASP files, the cookies aren't returned to the browser until the entire frameset is loaded. For this reason, if a session hasn't already been established (for example, a SessionID cookie hasn't been passed to the browser), Active Server Pages creates a new session for each ASP file within the frameset.

NOTE 1: If the session variable is initialized within the Session_OnStart of the global.asa and the variable increments (for example, a variable that holds a value indicating how many people have hit your site.), the value will increment by an amount equal to the number of frames containing ASP pages you have in your frameset. This behavior is due to the Session_OnStart executing for each ASP file in your frameset.

RESOLUTION

Active Server Pages maintains a session only when necessary (for example, if a session variable is created). To avoid this behavior, you must establish a session before the frameset is processed. In most cases, the easiest way to do this is by changing the file that defines the frameset from an HTML file to an ASP file.

MORE INFORMATION

Steps to Reproduce Behavior

Create the following files:

Main.htm:

   <HTML>
   <HEAD>
   <META NAME="GENERATOR" Content="Microsoft Developer Studio">
   <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
   <TITLE>Document Title</TITLE>
   </HEAD>
   <BODY>

   <FRAMESET FRAMEBORDER=0 SCROLLING=YES ROWS="15%, 70%, *">
       <FRAME NAME="Top" SCROLLING="NO" SRC="Top.asp">
       <FRAME NAME="Middle" SCROLLING="AUTO" SRC="Middle.asp">
       <FRAME NAME="Bottom" SCROLLING="NO" SRC="Bottom.asp">
   </FRAMESET>
   </BODY>
   </HTML>

Top.asp:

   <%@ LANGUAGE="VBSCRIPT" %>

   <HTML>
   <HEAD>
   <META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
   <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
   <TITLE>Document Title</TITLE>
   </HEAD>

   <BODY>
   <% Response.Write( "Top.asp: " & Session.SessionID ) %>
   <%'set a session variable I want to be global to all asp files in the
      frameset session("GlobalVar")="Top"%>
   </BODY>
   </HTML>

Middle.asp:

   <%@ LANGUAGE="VBSCRIPT" %>

   <HTML>
   <HEAD>
   <META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
   <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
   <TITLE>Document Title</TITLE>
   </HEAD>

   <BODY>
   <% Response.Write( "Middle.asp: " & Session.SessionID ) %>

   <SCRIPT LANGUAGE="VBScript">
      Sub CommandButton1_Click()
         'display the global variable set in top.asp
         msgbox "<%=session("GlobalVar")%>"
         'if GlobalVar is blank, it means the variable is scoped to a
         'different session.
      end sub
   </SCRIPT>

   <OBJECT ID="CommandButton1" WIDTH=96 HEIGHT=32
     CLASSID="CLSID:D7053240-CE69-11CD-A777-00DD01143C57">
        <PARAM NAME="Caption" VALUE="display gvar">
        <PARAM NAME="Size" VALUE="2540;846">
        <PARAM NAME="FontCharSet" VALUE="0">
        <PARAM NAME="FontPitchAndFamily" VALUE="2">
        <PARAM NAME="ParagraphAlign" VALUE="3">
   </OBJECT>
   </BODY>
   </HTML>

Bottom.asp:

   <%@ LANGUAGE="VBSCRIPT" %>

   <HTML>
   <HEAD>
   <META NAME="GENERATOR" Content="Microsoft Visual InterDev 1.0">
   <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
   <TITLE>Document Title</TITLE>
   </HEAD>

   <BODY>
   <% Response.Write( "Bottom.asp: " & Session.SessionID ) %>
   <% Session("MyVar") = "Bottom" %>
   </BODY>
   </HTML>

Browse Main.htm and you will see that the session IDs are all different.

Rename Main.htm to Main.asp, and add the following line of code after the </FRAMESET> tag:

   <% Session("MyVar") = "Main" %>

Note that only one session is created and is maintained until the session ends.
Keywords          : VIMisc
Technology        : kbInetDev kbinetdev
Version           : WINDOWS:1.0
Platform          : WINDOWS
Issue type        : kbbug


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: December 15, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.