Passing parameters to classic ASP include files

asp-classicinclude

I have to use classic ASP to build a website.
I want to be able to use include files for the header and footer.

How do I pass variables to the include files so that I can affect such things as titles etc.
Here is some examples of what I want to do:

index.asp

<%
dim title
title="TITLE"

'Server.Execute("header.inc") <--- Note I tried this but it didnt work also
%>
<!--#include file="header.inc" -->

header.inc

<html>
<head>
    <title><% Response.write title %></title>

Best Answer

document.write is client-side JavaScript. What you want in header.inc is:

<html>
<head>
    <title><%=title%></title>

Or more verbosely:

<html>
<head>
    <title><% Response.Write title %></title>

Other than that, what you have should work (without the Server.Execute, just do the include as you show further down).

Related Topic