Microsoft KB Archive/280300

= BUG: WithEvents Causes BeginRequest, EndRequest, and Start Events Not to Fire from WebClass =

Article ID: 280300

Article Last Modified on 10/15/2002

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q280300



SYMPTOMS
When you use the WithEvents keyword to handle events of an object within a Visual Basic 6.0 Internet Information Services (IIS) application (WebClass), the BeginRequest, EndRequest, and Start events of the WebClass fail to fire.



CAUSE
The WebClass runtime's events are being overridden. The WithEvents keyword causes the object to be bound to the same EventSink as the WebClass object. The WebClass object in the EventSink is overridden and removed by the new object. As a result, the BeginRequest, EndRequest, and Start events are not fired because the only object in the EventSink is the object declared as WithEvents and this object does not have these events.



RESOLUTION
In general, because Microsoft Active Server Pages (ASP) should process requests as fast as possible and return immediately to the client, you should not call components that are waiting for event notifications from other components. If you must use events within your WebClass application, wrap the object that is handling the events in a COM object that you can call from the WebClass.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

