Results 1 to 6 of 6

Thread: yet again... include files

  1. #1

    Thread Starter
    Fanatic Member wildcat_2000's Avatar
    Join Date
    Nov 2000
    Location
    Italy
    Posts
    727

    Resolved 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! <=

  2. #2
    Banned jhermiz's Avatar
    Join Date
    Jun 2002
    Location
    Antarctica
    Posts
    2,492

    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.

  3. #3
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    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.

  4. #4

    Thread Starter
    Fanatic Member wildcat_2000's Avatar
    Join Date
    Nov 2000
    Location
    Italy
    Posts
    727
    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! <=

  5. #5
    Hyperactive Member
    Join Date
    May 2003
    Location
    india
    Posts
    273

    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

  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170
    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
  •  



Click Here to Expand Forum to Full Width