Link to home
Start Free TrialLog in
Avatar of John Carney
John CarneyFlag for United States of America

asked on

Problems getting a server-side include working

Please take a look at these 2 pages and let me know what else I need to get the headet included in the other page? Does the server-side include work in an html file, or does it need to be php or asp.net?

http://travelnursecpa.com/header.html
http://travelnursecpa.com/index_wInclude.html

I don't really know if I have this question in the right zones, so please let me know what zones would be appropriate.

Thanks!

John
ASKER CERTIFIED SOLUTION
Avatar of Seven price
Seven price
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of John Carney

ASKER

Excellent thanks. So  since I'm slightly more familiar ASP.NET than PHP (I know how to do registration and login),  am I correct that I have to put my html inside an asp.net form and save as  an aspx file?

Having done that, how and where do I declare the variable? Exactly what code would constitute the entire complete variable,  and where would it go? Would it go in the aspx.cs file or the aspx file or both?

Thanks,

John
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Excellent, thanks! I couldn't get yours to work as is but I did get something very similar working. See the 3 codes below.

I've noticed that the files to be included don't have to be aspx, html will do just fine. Only the calling file has to be aspx, and in any event the files to be included can not have a page directive when they are aspx files.

Thanks a lot,

John

TESTINDEX1.HTML
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="utf-8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>INDEX</title>
</head>
<body>
 <form id="Form1" method="post" runat="server"> 
 <!--#include virtual="TestHeader1.aspx" -->
 Blah, blah, blah ...
  <!--#include virtual="Wisdom.aspx" -->
 </form>
</body>
</html>
 
TESTHEADER1.ASPX
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HEADER</title>
<style>
#header{width:890px; height:30px; padding:50px 0; text-align:center; background:#33CCCC; border:2px solid white}
</style>
</head>
<body>
<div id="header">
This is my header
</div>
</body>
</html>
 
WISDOM.ASPX
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
"One should never increase, beyond what is necessary,
the number of entities required to explain anything."
</body>
</html>

Open in new window

Thanks again.