Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

include html file in aspx page

Tags:

html

asp.net

I have this <div class='divname'>...</div> where I use this in many other pages. Instead of repeating this code can we create a html file and include it in aspx page? if yes how?

I am not using Masterpage, and my backend is vb.net

like image 963
Elyor Avatar asked Aug 07 '15 10:08

Elyor


People also ask

Can we include HTML file in HTML?

Simple Markup in the Header Embedding an HTML file is simple. All we need to do is use the common „<link>“ element. Then we add the value „import“ to the „rel“ attribute. Using „href“ we attach the URL of the HTML file, just like we are used to when it comes to stylesheets and scripts.

What ASPX file contains?

What is an ASPX file? A file with . aspx extension is a webpage generated using Microsoft ASP.NET framework running on web servers. ASPX stands for Active Server Pages Extended and these pages are displayed in web browser at user end when the URL is accessed.


1 Answers

An alternative to include plain html in your .aspx files is to use old asp include directive, like this:

<!-- #include file="~/path/to/your-static-file.html" -->

This way you don't need to create .net controls or masterpage as you said, just include the file you already have.

like image 131
zed Avatar answered Sep 23 '22 16:09

zed