i have a asp.net file called header.aspx and which is a part of index.aspx, here is the code of the index.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="index.aspx.cs" Inherits="index" %>
<!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 runat="server">
<title></title>
</head>
<body>
<% Response.WriteFile("header.aspx"); %>
<% Response.WriteFile("body.aspx"); %>
<form runat="server">
<%= content %>
</form>
</body>
</html>
in header.aspx :
<style type="text/css">
.style1
{
width: 100%;
}
</style>
<form id="form1" runat="server">
<table border="0" cellpadding="0" cellspacing="0" class="style1">
<tr>
<td><img src="images/Banner.jpg" width="990" height="150" /></td>
</tr>
<tr>
<td>
<img src="images/HomeTopMenu.jpg" width="140" height="30" /><img src="images/AboutTopMenu.jpg" width="140" height="30" /><img src="images/PublicationTopMenu.jpg" width="195" height="30" /><img src="images/FormTopMenu.jpg" width="205" height="30" /><img src="images/LinkTopMenu.jpg" width="160" height="30" /><img src="images/ContactTopMenu.jpg" width="150" height="30" />
<% Response.Write("abc"); %>
</td>
</tr>
</table>
</form>
when i run the index.aspx file, the <% Response.Write(“abc”); %> is displayed as plain text…
how to use asp.net code in header.aspx?
thanks
Rather than using
Response.WriteFile("header.aspx"), try usingServer.Execute("header.aspx"). This will actually run theheader.aspxfile. Using Response.WriteFile gets the actual contents of the file, and does not execute it.