FIX: .inc Include Files Not Loading in ASP.NET Website Print

  • #include not working IIS, .inc file not loading in ASP.NET, ServerSideIncludeModule IIS, enable include files in IIS ASP.NET, SSI ASP.NET website, fix footer.inc not loading, handler mapping .inc file, .inc file IIS configuration
  • 0

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

  • .inc files display as plain text or fail to load

  • #include statements 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

  1. Login to Your Windows Server
    Use Remote Desktop (RDP) to access the server environment.

  2. Open IIS Manager
    You can open it by pressing Windows + R, typing inetmgr, and hitting Enter.

  3. Select Your Website
    In the left-hand panel, expand the server tree and choose your target website.

  4. Open Handler Mappings
    Double-click on Handler Mappings in the Features View.

  5. Add a Module Mapping
    In the Actions panel on the right, click Add Module Mapping.

  6. Enter the Following Details:

    • Request Path: *.htm (or use *.inc if you want to target only .inc files)

    • Module: ServerSideIncludeModule

    • Name: SSI-htm

  7. Click OK to save the mapping.


What to Expect After Configuration

After adding the handler mapping:

  • IIS will begin to process .inc files.

  • 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.


Was this answer helpful?

« Back

Powered by WHMCompleteSolution