|
-
Oct 20th, 2004, 04:07 AM
#1
Thread Starter
Fanatic Member
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...? any suggestions? getting crazy on this one.
cheers and thank to you all,
wc.
Last edited by wildcat_2000; Nov 25th, 2004 at 07:06 AM.
When your car breaks down,
close all windows and retry 
=> please rate all users posts! <=
-
Oct 20th, 2004, 05:54 PM
#2
Banned
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.
-
Oct 20th, 2004, 11:02 PM
#3
PowerPoster
I second that whole heartedly. Don't move half way to ASP.NET, move ALL the way. Include files should really be avoided, they just are not needed anymore.
-
Oct 21st, 2004, 06:15 AM
#4
Thread Starter
Fanatic Member
hi there,
agreed. my question was:
'i need to do something like this in .net, how should i proceed to implement it in asp.net?'
not: 'how do i modify this to make it work also in .net'.
basically, i didn't know how to make user controls. thanks jhermiz, that is exactly how i managed to write what i needed.
cheers,
wc.
When your car breaks down,
close all windows and retry 
=> please rate all users posts! <=
-
Nov 19th, 2004, 06:06 AM
#5
Hyperactive Member
include in asp.net
hi ,
i have some asp page and they are working fine. I want to use/ call there page in asp.net as it is , for that i am tring this
<!--#include virtual="Hello.asp"--> .
the Hello.asp contains ..
<% response.write "Hello" %>
this work fine if i changed to <% response.write ( "Hello") %>
since i have lot of pages i cant change the code of original asp .
can anybody suggest how to make it compatible with asp.net
thanks in advance
PPCC
-
Nov 19th, 2004, 06:56 AM
#6
Please don't crosspost.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|