DOCUMENT:Q191039 07-AUG-1998 [vbwin] TITLE :HOWTO: Build an IIS Application and References PRODUCT :Microsoft Visual Basic for Windows PROD/VER: OPER/SYS:WINDOWS KEYWORDS: ====================================================================== --------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic Professional and Enterprise Editions for Windows, version 6.0 --------------------------------------------------------------------- SUMMARY ======= Building your first IIS application can have some minor pit falls. This article describes a simple IIS application to get you going. MORE INFORMATION ================ Steps to Build a Simple IIS Application ---------------------------------------- 1. From the File menu, select New Project, and then select IIS application. 2. Give your project a name and save the project. You cannot import a HTML file without saving the project first. 3. From the WebClass designer window,, select the toolbar item Add HTML Template Webitem, and then select an HTML file to add to your project. NOTE: If you choose a xxx.htm in the working directory of your project, the WebClass designer makes a copy of the xxx.htm and renames it xxx1.htm in the working directory of your project. xxx1.htm is the HTML file the WebClass designer will be making changes to, not the xxx.htm: WebClass designer does not need the xxx.htm file. But, if you choose a xxx.htm not in the working directory of your project, it will make a copy in the working directory of your project and not change the name from xxx.htm. 4. By default, this HTML Template Webitem will be called Template1 in the WebClass designer window. 5. View the Private Sub WebClass_Start(). It has code to display a default browser page. Comment out this code or delete it so the Start event looks like the following: Private Sub WebClass_Start() Set NextItem = Template1 end Sub NextItem is used to shift processing from one WebItem to another during a single request. Using the NextItem will cause the Private Sub Template1_Respond() to fire. 6. Here is a sample Private Sub Template1_Respond(): Private Sub Template1_Respond() Template1.WriteTemplate End Sub The Template1.WriteTemplate will send the contents of Template1 to client browser window. Remember that Template1 is the HTML file you imported into the IIS application. If you don't put anything in this event and you run the project, the browser will come up with a blank page. You should do a dry run of this process to see how it works. 7. Hit the F5 key to run the project. The WebClass designer will prompt you with a default Virtual directory that it is going to create in which to run the WebClass. 8. The page you created should have come up in the browser. Now change some code to experiment: Private Sub Template1_Respond() 'Write a reply to the user With Response .Write "" .Write "" .Write "

WebClass1's Starting Page

" .Write "

Response was created in the Template1_Respond event

" .Write "" .Write "" End With End Sub 9. Press the F5 key to run the project. 10. Go to your projects Properties. On the General tab, set these project options for optimal performance: Retain In Memory, Unattended Execution and Apartment Threaded. REFERENCES ========== Please see the following Microsoft Knowledge Base articles for more information on WebClasses: ARTICLE-ID: Q189539 TITLE : WebClass Section of Visual Basic 6.0 Readme.htm ARTICLE-ID: Q191038 TITLE : WebClass Initialize, BeginRequest, Terminate Events ARTICLE-ID: DocId 41154 TITLE : Access Denied Error on WebClass Files ARTICLE-ID: DocId 41414 TITLE : Do Not Modify ASP File Created by WebClass ARTICLE-ID: DocId 41092 TITLE : Option Explicit Statement Is Not Added by WebClass Designer ARTICLE-ID: DocId 41111 TITLE : Need to Remove the "Me" References from WcDemo Sample ARTICLE-ID: DocId 41222 TITLE : Change Default HTML Editor At the following location on the MSDN there is more detailed information about Developing IIS applications: Visual Basic Documentation\Using Visual Basic\Component Tools Guide\ Building Internet Applications\Developing IIS Applications Additional query words: kbDSupport kbVBp600 kbInternet kbWebClasses kbdsi kbDSupport kbVBp ====================================================================== Platform : WINDOWS Issue type : kbhowto ============================================================================= 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 1998.