KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q172063: PRB: Visual Basic UserDocuments Are Displayed as Garbage Text

Article: Q172063
Product(s): Microsoft Visual Basic for Windows
Version(s): 5.0,6.0
Operating System(s): 
Keyword(s): kbActiveX kbInternet kbVBp kbVBp500 kbVBp600 kbDSupport
Last Modified: 01-JUN-2001

-------------------------------------------------------------------------------
The information in this article applies to:

- Microsoft Visual Basic Professional Edition for Windows, versions 6.0, 5.0 
- Microsoft Visual Basic Enterprise Edition for Windows, versions 6.0, 5.0 
- Microsoft Visual Basic Control Creation Edition for Windows, version 5.0 
-------------------------------------------------------------------------------

SYMPTOMS
========

When the UserDocument files are placed on a UNIX or NetScape Web server,
Internet Explorer fails to display the UserDocument correctly. Internet Explorer
interprets the raw binary data of the .vbd file as text and displays a series of
random (garbage) characters, including boxes or symbols.

CAUSE
=====

This occurs because some Web servers often associate the incorrect content type,
or MIME type, with files whose extensions are unrecognized.

.vbd files are binary files that contain the persistent properties that are
exported by the UserDocument. When Internet Explorer downloads these files, it
must know to treat them as binary files, not as text files.

Some Web servers will, by default, associate all files whose extensions are
unrecognized with the content type "text/plain." Because .vbd is not a commonly
used file-extension, .vbd files on problem servers will often get branded as
"text/plain."

When Internet Explorer receives the "text/plain" content type HTTP header, it
will attempt to display the .vbd file as a text file. This results in the
garbage characters that appear in the window. When it receives the
"application/octet-stream" content type instead, it saves the .vbd file into the
Internet Explorer cache and then activates the associated Visual Basic
UserDocument for that .vbd file.

This problem will not occur on Microsoft Internet Information Server (IIS)
because it associates all files with unrecognized file extensions with the
content type "application/octet-stream."

RESOLUTION
==========

There are two possible ways to avoid this problem on Web servers that cause this
problem:

Method 1
--------

The Web server administrator can add a content type association manually for .vbd
files so that Internet Explorer will correctly display these files. The exact
steps to do this vary according to the Web server. In general, the association
needs to exist for the file extension .vbd to the MIME content type
"application/octet-stream."

Method 2
--------

The actual extension for Structured Storage files is not very important. Embedded
within the .vbd file is the unique identifier for the UserDocument that knows
how to display and save the properties that are contained within the .vbd file.
This identifier is retrieved and used regardless of the actual extension of the
file. However, to avoid confusion and conflicts with other file extensions, it
is recommended that an extension is chosen that is already associated with the
content type "application/octet-stream" and is not associated with other content
types. The extension .bin generally works well.

However, following this method and making this change often requires a few other
changes as well. The .htm file that is generated by the Application Setup Wizard
must be changed. Locate the line that causes Internet Explorer to navigate to
the .vbd file, and change the extension from .vbd to .bin. Also, if the Active
Document code uses a Hyperlink object to navigate to other .vbd files, these
filename extensions will need to be renamed from .vbd to .bin as well.

STATUS
======

This behavior is by design.

MORE INFORMATION
================

"Active Document" is the term for what was once called an "ActiveX Document."
When this article refers to a "UserDocument," this is taken to mean the Visual
Basic 5.0 technology that allows Visual Basic forms to be hosted as Active
Documents in Active Document containers such as Internet Explorer.

Additional query words:

======================================================================
Keywords          : kbActiveX kbInternet kbVBp kbVBp500 kbVBp600 kbDSupport 
Technology        : kbVBSearch kbAudDeveloper kbZNotKeyword6 kbZNotKeyword2 kbVB500Search kbVB600Search kbVBA500Search kbVBA500 kbVBA600 kbVB500 kbVB600 kbZNotKeyword3
Version           : :5.0,6.0
Issue type        : kbprb

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

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.

Copyright Microsoft Corporation 1986-2002.