ASPProtect ( Click Here For More Details !!! )
Return To Home Page - Link to "The Wanker" - Contact Us


Return To Home Page

Server Side Include Example



Server-side includes give you a way to insert the content of another file into a file before the server processes it. ASP implements only the #include directive of this mechanism. To insert a file into an .asp file, Use the following syntax:

<!--#include file = "myfile.asp"-->

This would include a file in the same directory of the asp script that contains this statement. You can also use things like "../somedirectory/somefile.asp" and "somedirectory/somefile.asp" to specify the location of the file.

<!--#include virtual = "/somedirectory/somefile.asp"-->

This would include a file on your site located virtually.
 
However since includes are inserted before the server processes the ASP you cannot use an asp variable to dynamically change the file being included.

You could have a series of (if/else) statements with different Includes within each one.

Example:

<% if bla = "1" then %>
<!--#include file="file1.asp"-->
<% elseif bla = "2" then %>
<!--#include file="file2.asp"-->
<% end if %>


You could also include another asp file and then have that file perform the tests neccessary to determine the page to be directed to.

Example:

<!--#include file="determinefile.asp"-->

And the contents of determinefile.asp would be.

<% if bla = "1" then %>
<% response.write("file1.asp") %>
<% elseif bla = "2" then %>
<% response.write("file2.asp") %>
<% end if %>


Banner
ASP (Active Server Pages) is a technology developed by Microsoft. Pages using ASP are primarily developed in JScript, or VBScript and are integrated into the HTML of your Web pages. The ASP code is compiled on-the-fly by the server and the resulting output is standard HTML. By using ASP, Web pages can be dynamic, full of ever-changing content, and browser independent.
Active Server Pages ASP ASP.NET .aspx .ascx Web HTML Developer Internet Microsoft Web Services Visual Studio .NET CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspclassifieds.com, www.powerasp.com,www.cjwsoft.com,www.aspphotogallery.com,www.codewanker.com,www.aspprotect.com,www.aspbanner.com,www.abay.com

 

Link to "The Wanker"
© 2007 CodeWanker - Active Server Pages Articles, Code Snippets, & Tutorials