|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
WebClass Changes in Visual Basic .NET
In Visual Basic 6.0, WebClass projects (also known as IIS Application projects) were used to create Web applications based on Active Server Page (ASP) technology.
In Visual Basic .NET, ASP.NET Web Application projects are used to create Web applications based on the newer ASP.NET technology. When a Visual Basic 6.0 WebClass project is upgraded to Visual Basic .NET, it is converted to an ASP.NET Web Application project.
In Visual Basic 6.0, WebClass projects had a StateManagement property that could be used to keep an instance of the webclass alive between requests. This was done by setting the StateManagement property to 2 – wcRetainInstance at design time; there was also a ReleaseInstance method that could be used to terminate an instance.
In Visual Basic .NET, ASP.NET Web applications do not have a StateManagement property; the model for managing application state differs considerably. Any code related to state management will need to be replaced. For more information, see Web Forms State Management.
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.
Declarations will be 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 will be 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.
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. For more information, see Migrating to Web Forms.