PRB: Cannot Use ExecWB() to Print HTML Documents with Print Templates in Visual Basic (308649)
The information in this article applies to:
- Microsoft Internet Explorer (Programming) 5.5 SP2
- Microsoft Internet Explorer (Programming) 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Learning Edition for Windows 6.0
- Microsoft Visual C++, 32-bit Enterprise Edition 6.0
- Microsoft Visual C++, 32-bit Learning Edition 6.0
- Microsoft Visual C++, 32-bit Professional Edition 6.0
This article was previously published under Q308649 SYMPTOMS
When you try to pass values to the third and fourth parameters of the WebBrowser control's ExecWB method, if the first parameter is OLECMDID=OLECMDID_PRINT, you may receive the following error message:
Run-time error '70': Permission Denied
After you install Internet Explorer 5.5 Service Pack 2 (SP2) or later, you can no longer use ExecWB to print Hypertext Markup Language (HTML) documents with print templates in Visual Basic or Visual C++. In addition, this problem occurs with Internet Explorer 5.5 SP1 after you install the security update that is available in the following Microsoft Knowledge Base article:
279328 Patch Available for "Browser Print Template" Vulnerability
CAUSE
As Q279328 describes, a vulnerability exists in this feature that enables a Web-based program to invoke a custom print template without permission from the user. This poses a security hazard because, by design, print templates are trusted code and thus are able to run ActiveX controls, even those controls that are not marked as safe for scripting.
RESOLUTION
There is currently no workaround to use ExecWB to pass a print template into the printing process because the action is not secure and presents a security hazard to the computer.
However, you can still use Visual C++ and the Exec method to parse in a print template to the print preview and print the document. You cannot achieve the same functionality in Visual Basic or in any scripts.
REFERENCES
For more information, refer to the following MSDN article:
For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:
Modification Type: | Major | Last Reviewed: | 5/11/2006 |
---|
Keywords: | kbprb kbWebBrowser KB308649 |
---|
|