If your ASP.NET website isn't rendering .inc files—commonly used for headers, footers, or other reusable components through #include directives—it's likely due to missing handler mappings in IIS.
This issue often affects elements like footer.inc or header.inc, which are essential for consistent page layout.
Common Symptoms
-
Layout issues due to missing header or footer content
-
.incfiles display as plain text or fail to load -
#includestatements appear in the browser instead of being executed
Cause
IIS does not process .inc files by default. To support server-side includes (SSI), you must configure IIS to recognize and handle these files correctly.
Solution: Enable .inc File Includes in IIS for ASP.NET
Follow the steps below to configure IIS so it can process .inc files correctly.
Prerequisites
-
Access to your Windows server via Remote Desktop (RDP)
-
Administrative rights
-
IIS Manager installed
Step-by-Step Guide
-
Login to Your Windows Server
Use Remote Desktop (RDP) to access the server environment. -
Open IIS Manager
You can open it by pressingWindows + R, typinginetmgr, and hitting Enter. -
Select Your Website
In the left-hand panel, expand the server tree and choose your target website. -
Open Handler Mappings
Double-click on Handler Mappings in the Features View. -
Add a Module Mapping
In the Actions panel on the right, click Add Module Mapping. -
Enter the Following Details:
-
Request Path:
*.htm(or use*.incif you want to target only.incfiles) -
Module:
ServerSideIncludeModule -
Name:
SSI-htm
-
-
Click OK to save the mapping.
What to Expect After Configuration
After adding the handler mapping:
-
IIS will begin to process
.incfiles. -
Page components like headers and footers will render as expected.
-
No changes to your ASP.NET source code are required.
Additional Tips
-
If the option is unavailable, ensure the Server Side Includes feature is installed via Server Manager > Add Roles and Features.
-
You can optionally create separate mappings for
.inc,.shtml, or other custom extensions.