Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Included Configuration File

ASP 102

Included Configuration File

by  Bullschmidt  Posted    (Edited  )
With a project to help reuse code there are often things that you'd like to have set in one place. Thus if you ever need to change something like the title of the site or the version date it could be changed in only one page instead of having to make the change on every page of the site.

To do this perhaps create a file (called something like config.asp) to be included in each page. It could contain things like this:
<%
mstrSiteTitle = "Bullschmidt.com"
mstrColorMain = "#FFFFFF"
mintSessionTimeoutMin = 60
mvarVersionDt = DateSerial(2003, 1, 1)
%>

And the following line would be located toward the top of most Web pages to include the config.asp file:
<!--#include file="config.asp"-->

And then on your Web pages you could use things from the config.asp file like this:
<% Session.Timeout = mintSessionTimeoutMin %>
<title><%= mstrSiteTitle %> - ASP Web Developer Tips</title>
<body bgcolor="<%= mstrColorMain %>">
Design updated <%= FormatDateTime(mvarVersionDt, vbShortDate) %>

And the outputed HTML code would look like this:
<title>Bullschmidt.com - ASP Web Developer Tips</title>
<body bgcolor="#FFFFFF">
Design updated 1/1/2003

And the session timeout would be set at 60 minutes instead of whatever the server's default was set to. And by the way if your site has an initial login page, you might just set the session timeout once on that page.

Best regards,
J. Paul Schmidt
www.Bullschmidt.com - Freelance ASP Web Developer
www.Bullschmidt.com/DevTip.asp - ASP Web Developer Tips
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top