yet again... include files
hello all,
i'm new to .net and trying to migrate asp to asp.net.
my issue is with include files. i've got an ASP file this way:
Code:
<%
Dim MyVar
MyVar = "file1.inc"
%>
<html>
<body>
<!--#include file="<%=MyVar%>"-->
</body>
</html>
file file1.inc is:
Code:
<%
Response.Write "HELLO!"
%>
what i want to do:
1. define the name file1.inc programmatically (like in the ASP.OLD example here above);
2. make sure the included file CAN RUN some code (like in the ASP.OLD example here above).
so:
1.
i just can't get to have an include file defined programmatically like this in asp.net: using <!--#include file="<%=MyVar%>"--> in asp.net won't do since it interprets the <% as wrong path character (basically, doesn't read it as code).
i'm trying the
Code:
<%@ Register TagPrefix="topMenu" TagName="topMenu" Src="topMenu.ascx" %>
however apparently i can't define the Src tag on code: if left empty or not an .ascx file it generates errors.
2.
M$ suggests the Response.WriteFile method, however this does not allow execution of code, of course!
what the...? :mad: any suggestions? getting crazy on this one.
cheers and thank to you all,
wc.
Re: yet again... include files
Why do ASP developers work in asp.net but still try to write asp
?????
It makes no sense to me at all...you're in asp.net now, you should be creating user controls and adding them to your pages.