Configuration File

This section describes the configuration file in ASP script to be used as an include file for the main ASP script page.

The easiest way to set up configuration files with ASP pages is to use include files. For hyBook, I used one include file, _config.inc, to maintain all configurable items:

<%
'  _config.inc 
'
'  Configuration file
'  hyBook version 2005.12.11
'  Copyright (c) 2005 by Dr. Herong Yang, http://www.herongyang.com/
  
'  Database connection
   Dim ogConn
   Set ogConn = Server.CreateObject("ADODB.Connection")

'  Number of submits per IP per day 
   Dim ngSubmitLimit
   ngSubmitLimit = 10

'  Default topic ID
   Dim ngDefaultTopicID
   ngDefaultTopicID = 14

'  Page title
   Dim sgPageTitle
   sgPageTitle = "hyBook Demo"

'  Debugging flag
   Dim bgDebug, ogDebug 
   bgDebug = False
   Set ogDebug = Nothing

Sub dbConnect
   ogConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
      Server.MapPath("/cgi-bin/hyBook.mdb")
      
   If bgDebug Then
      Set oFileSys = Server.CreateObject("Scripting.FileSystemObject")
      Set ogDebug = oFileSys.OpenTextFile("\temp\hyBook.log", 8, True)
      ogDebug.WriteLine("Open data base connection.")
   End If
End Sub

Sub dbClose
   Set ogConn = Nothing

   If bgDebug Then
      ogDebug.WriteLine("Close data base connection.")
      ogDebug.Close
   End If
End Sub
%>

Note that:

Last update: 2006.

Table of Contents

 About This Book

 ASP (Active Server Pages) Introduction

 IIS (Internet Information Services) 5.0

 MS Script Debugger

 VBScript Language

 ASP Built-in Run-time Objects

 ASP Session

 Creating and Managing Cookies

 Managing Sessions with and without Cookies

 scrrun.dll - Scripting Runtime DLL

 Managing Response Header Lines

 Calculation Speed and Response Time

 ADO (ActiveX Data Object) DLL

 Working with MS Access Database

Guest Book Application Example

 Design Overview

 Database Tables

Configuration File

 Page Layout Template File

 Guest book Main Script

 The Utility Script Library File

 Data Submission Issues

 Webmaster Administration Page

 References

 PDF Printing Version