views:

26

answers:

3

I have a classic asp website, onto which I am adding an asp.net (.aspx) page. Is it possible to include my existing asp header (header.asp) and footer (footer.asp) files on my aspx page?

I don't want to convert the page to a user control, because those pages include other asp pages with asp code on them.

Thanks

+1  A: 

There's a rudimentary way of doing this described at Microsoft support. In a nutshell:

<%@ Page Language="vb" AutoEventWireup="false"%>
<html>
<body>
     <%        
       Response.WriteFile ("Yourfile.inc")
     %>
</body>
</html>

One thing that may pose a problem for you is that this won't execute any classic asp code that's in your header/footer files, so wouldn't work for that scenario. If that's the case you may need to consider duplicating the content into an asp.net Master Page and maintaining two copies of the content.

Rob
A: 

As far as I am aware this is not possible as asp.net does not support vb script only full vb.net.

You could use an iframe to hold the classic asp includes, but then you run into problems where you have two separate sessions, classic asp and asp.net as they are not shared.

Tim B James
A: 
<div id="header"/>
<div id="footer"/>

$(document).ready(function()
{
   $("#header").load("header.asp");
   $("#footer").load("footer.asp");
}
Alex Reitbort
where would i put this function? it doesn't look like asp.net to me...
it is javascript using jquery. Include jquery in your master page and put this in script block.
Alex Reitbort
I don't have a master page. This is an asp site, with one page of .net added. Is there a way to do this with non-jquery javascript?
Yes there is, but it is much more complicated.
Alex Reitbort