INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

ASP 102

Included Configuration File by Bullschmidt
Posted: 28 May 03 (Edited 28 May 03)

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

Back to Microsoft: ASP (Active Server Pages) FAQ Index
Back to Microsoft: ASP (Active Server Pages) Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close