<!--#include virtual="/virtual/path/file.inc"--> <!-- 從虛擬目錄根目錄起算 -->
<!--#include file="relative/path/file.inc" --> <!-- 相對於目前檔案目錄 -->
virtual:以網站虛擬目錄為起點 (如 /includes/header.inc)
file:相對路徑 (如 ../common/config.inc),不得使用 .. 跳出網站根目錄。
mypage.asp<!DOCTYPE html>
<html>
<body>
<h3>名言精選:</h3>
<p><!--#include file="wisdom.inc"--></p>
<h3>目前時間:</h3>
<p><!--#include file="time.inc"--></p>
</body>
</html>
wisdom.inc"One should never increase, beyond what is necessary,
the number of entities required to explain anything."
time.inc<%
Response.Write(Time)
%>
<!DOCTYPE html>
<html>
<body>
<h3>名言精選:</h3>
<p>"One should never increase, beyond what is necessary,
the number of entities required to explain anything."</p>
<h3>目前時間:</h3>
<p>11:33:42 AM</p>
</body>
</html>
<% %> 內使用變數決定檔名。<%
fname = "header.inc"
%>
<!--#include file="<%fname%>"--> <!-- 無效 -->
<% %> 迴圈中放置 include,需拆分腳本區塊:
<% For i = 1 To n %>
<!--#include file="count.inc" -->
<% Next %>
.asp 副檔名,避免被直接瀏覽下載。.inc 檔若被直接請求會以純文字顯示內容。ASP.NET 使用 User Control (.ascx)、Master Page、Partial View (MVC/Razor Pages) 或 Tag Helpers (Core) 實現更強型別、支援設計時期驗證的模組化重用。