ASP PAGE STRUCTURE(SERVER SIDE INCLUDE DIRECTIVES)

Server-side Include Directives

  • We can include a file in an ASP.NET page by using one of the two forms of the server-side include directive. 
  • If  we want to include a file that is located in the same directory or in a sub directory of the page including the file,  use the following directive:

<!-- #INCLUDE file="includefile.aspx" -->

  • Alternatively, we can include a file by supplying the full virtual path.
  •  For example, if you have a sub directory named myDirectory under the www root directory, We can include a file from that directory like this:


<!-- #INCLUDE virtual="/myDirectory/includefile.aspx" -->

  • The include directive is executed before any of the code in a page.
  •  One implication is that we cannot use variables to specify the path to the file that we want to include.

No comments:

Post a Comment