Dela via


WebClasses for Visual Basic 6.0 Users

For the most part, the concepts and techniques for programming an ASP.NET Web site in Visual Basic 2008 are considerably different from those for creating Web classes in Visual Basic 6.0.

Conceptual Differences

In Visual Basic 6.0, WebClass projects (also known as IIS Application projects) are used to create Web applications based on ASP page technology.

In Visual Basic 2008, ASP.NET Web-site projects are used to create Web applications based on the newer ASP.NET technology.

State Management

In Visual Basic 6.0, WebClass projects have a StateManagement property that can be used to keep an instance of the WebClass alive between requests. This is done by setting the StateManagement property to 2 or wcRetainInstance at design time; there is also a ReleaseInstance method that can be used to terminate an instance.

In Visual Basic 2008, ASP.NET Web applications do not have a StateManagement property. The model for managing application state differs considerably, and any code related to state management needs to be replaced. For more information, see ASP.NET State Management.

Upgrade Notes

When a Visual Basic 6.0 WebClass project is upgraded to Visual Basic 2008, it is converted to an ASP.NET Web-site project.

Declarations are added to your project: one for the WebClass and one for each of the WebItems and Templates in the WebClass project. A Page_Load event procedure is added to the project, creating first a WebClass object and then WebItem objects for each of the WebItems and Templates associated with the Visual Basic 6.0 WebClass project. Finally, in the Page_Load event procedure, you will see a call to the WebClass Compatibility runtime: WebClass.ProcessEvents. This allows the runtime to render the WebItem specified in the Request URL. This code is the only new code added to your upgraded project and only serves to emulate the underlying behavior of the Visual Basic 6.0 WebClass runtime.

Function and Sub procedures in your Visual Basic 6.0 code (for example, ProcessTags or Respond) will have their scope changed from Private to Public to allow the WebClass Compatibility runtime to execute them.

Certain Visual Basic 6.0 WebClass events are not supported in ASP.NET (for example, Initialize, BeginRequest, EndRequest, and Terminate). These event procedures will be upgraded but will not be called at runtime. After upgrading, you will need to move any code in these events to equivalent ASP.NET events.

Note

There are a number of behavioral differences for properties, methods, and events between ASP and ASP.NET objects. Before upgrading a WebClass to ASP.NET, you should understand these differences so you know how to modify your code.

See Also

Concepts

Upgrading WebClass Projects to Visual Basic 2008

Reference

WebClass event is not supported