Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to include an external html file in asp.net page

Tags:

html

php

asp.net

How I can include an external html file in asp.net web page. In PHP we can use include function, if asp.net have any similar function, please let me know. My intention is, i have a common header html file, so I need to include that file in all aspx pages.

like image 579
Able Alias Avatar asked Dec 16 '22 11:12

Able Alias


2 Answers

Server side includes are available across different platforms and a useful for including static content. You can use them in IIS but I they need to be enabled in IIS7.

<!-- #include file="Static/Menu.html" -->

Instructions to enable SSI in IIS7 are available at http://tech.mikeal.com/

For dynamic content, there is a built-in method of templating called MasterPages, this should be used instead.

like image 78
Ant Swift Avatar answered Dec 28 '22 22:12

Ant Swift


I'm presuming this is web forms?

The most typical way to do this in asp.net would be to use a Master Page. Include your header in the master page and have the content page inherit from this.

like image 23
Mark Avatar answered Dec 28 '22 23:12

Mark