Ask a Question related to ASP, Design and Development.

  1. #1

    Default Include file

    Hi,

    Is there any way of having an include file as a string, eg:

    <!--#include file="<%=strURL%>"-->

    This doesn't seem to work, I get an error:

    The include file '<%=strURL%>' was not found

    Is my syntax wrong or isn't this possible?

    Cheers.


    Miguel Orrego Guest

  2. Similar Questions and Discussions

    1. Include a file
      have been tried to develop a blog like the sample php & mysql. I make an include from list from toolbox: Url parameter value: admin_topics...
    2. usercontrol with include file
      Hi, I put include file in usercontrol and use this UC in another aspx page. However, aspx file writes <!-- #include virtual="/fres/fues.htm" -->...
    3. Strange Include problems: Repeat regions will Not workwith include file
      I have a strange problem. I have an Index.asp page and on that page I have a poll that is displays. This poll is located in a sub folder, so to call...
    4. proper way to include constants; as module or include file?
      I am developing a new perl module that uses constants with regular expressions. What is the proper way to offer this file? For example, my perl...
  3. #2

    Default Re: Include file

    Miguel Orrego wrote on 15 jul 2003 in
    microsoft.public.inetserver.asp.general:
    > Is there any way of having an include file as a string, eg:
    >
    > <!--#include file="<%=strURL%>"-->
    >
    No, the include is executed before the asp-parsing,
    so that asp contents of the include get parsed too.

    Try server.execute

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan. Guest

  4. #3

    Default Re: Include file

    Try google - ther are hundreds of hits for using Server.Execute.
    [url]http://www.microsoft.com/windows2000/en/server/iis/default.asp?url=/windows2000/en/server/iis/htm/asp/vbob9pid.htm[/url]

    Chris.

    "Miguel Orrego" <miguel@stressedmonkey.net-nospam> wrote in message
    news:3f13eb6a$0$15040$cc9e4d1f@news.dial.pipex.com ...
    > Thanks, could you show me some example code using server.execute ?
    >
    > Cheers.
    >
    > "Evertjan." <exjxw.hannivoort@interxnl.net> wrote in message
    > news:Xns93B98990DE90Ceejj99@194.109.133.29...
    > > Miguel Orrego wrote on 15 jul 2003 in
    > > microsoft.public.inetserver.asp.general:
    > > > Is there any way of having an include file as a string, eg:
    > > >
    > > > <!--#include file="<%=strURL%>"-->
    > > >
    > >
    > > No, the include is executed before the asp-parsing,
    > > so that asp contents of the include get parsed too.
    > >
    > > Try server.execute
    > >
    > > --
    > > Evertjan.
    > > The Netherlands.
    > > (Please change the x'es to dots in my emailaddress)
    >
    >

    Chris Barber Guest

  5. #4

    Default Re: Include file

    Sorry, I'm lying, the images were in the same folder as the page I was
    calling.

    I've now put copies of those images into the same folder as the page I'm
    calling from and that seems to have fixed it.

    Strange though that it wouldn't work with the images left as they are.

    Cheers.

    "Miguel Orrego" <miguel@stressedmonkey.net-nospam> wrote in message
    news:3f13fc59$0$15041$cc9e4d1f@news.dial.pipex.com ...
    > Great, that seems to have acheived what I want, but only halfway.
    >
    > When calling a file that has images, the images don't show, just get the
    > usual box with a cross as you would get when the image file is not found.
    > The images are there, but the path to them from the called document would
    be
    > ../images/image1.jpg etc. Would this have an impact? Should the images be
    in
    > the same folder as the called document? Is there a way around this?
    >
    > Cheers.
    >
    > "Evertjan." <exjxw.hannivoort@interxnl.net> wrote in message
    > news:Xns93B98EF7627A1eejj99@194.109.133.29...
    > > Miguel Orrego wrote on 15 jul 2003 in
    > > microsoft.public.inetserver.asp.general:
    > > > "Evertjan." <exjxw.hannivoort@interxnl.net> wrote in message
    > > > news:Xns93B98990DE90Ceejj99@194.109.133.29...
    > > >> Miguel Orrego wrote on 15 jul 2003 in
    > > >> microsoft.public.inetserver.asp.general:
    > > >> > Is there any way of having an include file as a string, eg:
    > > >> >
    > > >> > <!--#include file="<%=strURL%>"-->
    > > >> >
    > > >>
    > > >> No, the include is executed before the asp-parsing,
    > > >> so that asp contents of the include get parsed too.
    > > >>
    > > >> Try server.execute
    > > > Thanks, could you show me some example code using server.execute ?
    > >
    > > <%
    > > myurl = "/myfile.asp"
    > > server.execute myurl
    > > %>
    > >
    > > not tested
    > >
    > > --
    > > Evertjan.
    > > The Netherlands.
    > > (Please change the x'es to dots in my emailaddress)
    >
    >

    Miguel Orrego Guest

  6. #5

    Default Re: Include file

    Miguel Orrego wrote on 15 jul 2003 in
    microsoft.public.inetserver.asp.general:
    > Sorry, I'm lying, the images were in the same folder as the page I was
    > calling.
    >
    > I've now put copies of those images into the same folder as the page I'm
    > calling from and that seems to have fixed it.
    >
    > Strange though that it wouldn't work with the images left as they are.
    >
    [please interpost and topquote]

    No, not strange, the relative path probably changes to the calling page
    with response execute.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan. Guest

  7. #6

    Default Include file

    I'm new in the .NET world, so sorry if this is a faq. In classic ASP I
    often use a include file with some standard functions, ex. formating a
    string an so. How do a do this i .NET ??

    In my test code below, I submit a form with a textbox, use the
    function "format_string" to change the value. I would like to use this
    function in other scripts also, so need to place the code in another
    file, and include it, how ?

    I'll appreciate if someone could change my test code, to show me the
    right way to do it.

    Thx..



    test.aspx
    ------------------
    <%@ page language="vb" inherits="test" src="test.vb" %>
    <html>
    <head>
    </head>

    <body>
    <form id="test" method="post" runat="server">
    <asp:textbox id="sometext" text="" runat="server" />
    <asp:button id="submit" text="submit" onclick="test_me"
    runat="server" />
    </form>
    </body>
    </html>
    ------------------


    test.vb
    ------------------
    Imports System
    Imports System.Web.UI

    public class test : inherits page
    sub test_me(ByVal Sender As Object, ByVal E As EventArgs)
    dim sometext as string
    sometext = format_string(Request.Form("sometext"))
    end sub

    function format_string(value as string) as string
    return "!" & value & "!"
    end function
    end class
    ------------------

    JH Guest

  8. #7

    Default Re: Include file

    The easiest way would be to make some utility classes.

    public class StringUtilities
    {
    public static string FormatString(string s)
    {
    string result;

    //Do something
    return result;
    }
    }


    And then in the code-behind you just use the class:

    private void Page_Load(...)
    {
    string s="Hello 123";
    s=StringUtilities.FormatString(s);
    }

    I hope this helps
    Hugo
    Hugo Wetterberg Guest

  9. #8

    Default Include file

    Hi

    Check out the following articles, which tells about How
    to include files in aspx.

    [url]http://www.csharpfriends.com/Articles/getArticle.aspx?[/url]
    articleID=9

    [url]http://www.aspalliance.com/stevesmith/articles/includelets[/url]
    ..asp

    Ravikanth

    >-----Original Message-----
    >I'm new in the .NET world, so sorry if this is a faq. In
    classic ASP I
    >often use a include file with some standard functions,
    ex. formating a
    >string an so. How do a do this i .NET ??
    >
    >In my test code below, I submit a form with a textbox,
    use the
    >function "format_string" to change the value. I would
    like to use this
    >function in other scripts also, so need to place the
    code in another
    >file, and include it, how ?
    >
    >I'll appreciate if someone could change my test code, to
    show me the
    >right way to do it.
    >
    >Thx..
    >
    >
    >
    >test.aspx
    >------------------
    ><%@ page language="vb" inherits="test" src="test.vb" %>
    ><html>
    > <head>
    > </head>
    >
    > <body>
    > <form id="test" method="post" runat="server">
    > <asp:textbox id="sometext" text="" runat="server" />
    > <asp:button id="submit" text="submit"
    onclick="test_me"
    >runat="server" />
    > </form>
    > </body>
    ></html>
    >------------------
    >
    >
    >test.vb
    >------------------
    >Imports System
    >Imports System.Web.UI
    >
    >public class test : inherits page
    > sub test_me(ByVal Sender As Object, ByVal E As
    EventArgs)
    > dim sometext as string
    > sometext = format_string(Request.Form("sometext"))
    > end sub
    >
    > function format_string(value as string) as string
    > return "!" & value & "!"
    > end function
    >end class
    >------------------
    >
    >.
    >
    Ravikanth[MVP] Guest

  10. #9

    Default Re: Include file

    > The easiest way would be to make some utility classes.

    Thanks for your reply.... I like the idea with a "utility class".


    I put this code in ex. "StringUtilities.vb", and place it in a shared
    include-folder
    -----
    > public class StringUtilities
    > {
    > public static string FormatString(string s)
    > {
    > string result;
    >
    > //Do something
    > return result;
    > }
    > }
    -----

    How do my codebehind code (test.vb) know about the class
    "StringUtilities" ??
    -----
    > private void Page_Load(...)
    > {
    > string s="Hello 123";
    > s=StringUtilities.FormatString(s);
    > }
    -----

    JH Guest

  11. #10

    Default Re: Include file

    On Thu, 24 Jul 2003 11:14:00 GMT, JH <003___remove___@email.dk> wrote:

    Everything is compiled into a single dll if it resides in the same
    project. All the classes and pages can use functions from each other.

    I've sent another post with what I think is the VB equivalent of what
    I posted in my first reply.
    >> The easiest way would be to make some utility classes.
    >
    >Thanks for your reply.... I like the idea with a "utility class".
    >
    >
    >I put this code in ex. "StringUtilities.vb", and place it in a shared
    >include-folder
    >-----
    >> public class StringUtilities
    >> {
    >> public static string FormatString(string s)
    >> {
    >> string result;
    >>
    >> //Do something
    >> return result;
    >> }
    >> }
    >-----
    >
    >How do my codebehind code (test.vb) know about the class
    >"StringUtilities" ??
    >-----
    >> private void Page_Load(...)
    >> {
    >> string s="Hello 123";
    >> s=StringUtilities.FormatString(s);
    >> }
    >-----
    Hugo Wetterberg Guest

  12. #11

    Default Re: Include file

    On Thu, 24 Jul 2003 11:14:00 GMT, JH <003___remove___@email.dk> wrote:

    Sorry here's the post I should have sent before:

    Saw that you are using VB, but it should be the same principle.
    Separate the format string subroutine from the page and put it in a
    class:

    public class StringUtilities

    public static function format_string(value as string) as string
    return "!" & value & "!"
    end function

    end class

    then change sub test_me to:

    sub test_me(ByVal Sender As Object, ByVal E As EventArgs)
    dim sometext as string
    sometext = StringUtilities.format_string(Request.Form("somete xt"))
    end sub

    Something like that anyway.
    Cheers, Hugo
    Hugo Wetterberg Guest

  13. #12

    Default Re: Include file

    Do you (can you) place these utility classes in a separate code file where
    they will be available to all parts of the application and reusable in other
    applications? If so what type (extension) of file do you create?

    thanks




    "Hugo Wetterberg" <hugo@wetterberg.com> wrote in message
    news:b1hvhvo7fl5mia86a8qsmvk98phumdnjot@4ax.com...
    > On Thu, 24 Jul 2003 11:14:00 GMT, JH <003___remove___@email.dk> wrote:
    >
    > Sorry here's the post I should have sent before:
    >
    > Saw that you are using VB, but it should be the same principle.
    > Separate the format string subroutine from the page and put it in a
    > class:
    >
    > public class StringUtilities
    >
    > public static function format_string(value as string) as string
    > return "!" & value & "!"
    > end function
    >
    > end class
    >
    > then change sub test_me to:
    >
    > sub test_me(ByVal Sender As Object, ByVal E As EventArgs)
    > dim sometext as string
    > sometext = StringUtilities.format_string(Request.Form("somete xt"))
    > end sub
    >
    > Something like that anyway.
    > Cheers, Hugo

    joe Guest

  14. #13

    Default Re: Include file

    On Thu, 24 Jul 2003 07:55:21 -0400, "joe"
    <contact_by_Newsgroup_only.please> wrote:

    Yes. That is the beauty with .net. Start a new class library project
    (or set the compilation target to library). The output from
    compilation will be a dll that you can reference to from your other
    projects.
    >Do you (can you) place these utility classes in a separate code file where
    >they will be available to all parts of the application and reusable in other
    >applications? If so what type (extension) of file do you create?
    >
    >thanks
    >
    >
    >
    >
    >"Hugo Wetterberg" <hugo@wetterberg.com> wrote in message
    >news:b1hvhvo7fl5mia86a8qsmvk98phumdnjot@4ax.com.. .
    >> On Thu, 24 Jul 2003 11:14:00 GMT, JH <003___remove___@email.dk> wrote:
    >>
    >> Sorry here's the post I should have sent before:
    >>
    >> Saw that you are using VB, but it should be the same principle.
    >> Separate the format string subroutine from the page and put it in a
    >> class:
    >>
    >> public class StringUtilities
    >>
    >> public static function format_string(value as string) as string
    >> return "!" & value & "!"
    >> end function
    >>
    >> end class
    >>
    >> then change sub test_me to:
    >>
    >> sub test_me(ByVal Sender As Object, ByVal E As EventArgs)
    >> dim sometext as string
    >> sometext = StringUtilities.format_string(Request.Form("somete xt"))
    >> end sub
    >>
    >> Something like that anyway.
    >> Cheers, Hugo
    >
    Hugo Wetterberg Guest

  15. #14

    Default Include file

    Hi,

    I have one question:
    I used to do a lot with asp and now I'm going to use asp.net technology
    In asp I had a file functions.asp with all my functions I used on several
    pages like generating connection to database, generating links on pages and
    things like that.
    Than I had <!-- #include file="..\include\functions.asp"--> statement on
    each asp page, at the top of the page.
    I would like to know, how is this in asp.net
    You use the same procedure or is there some other, better way to include
    functions?
    I read one book but I didn't found any instructions?

    Can someone explain me how this is practice in asp.net?

    Thank you,
    Simon


    Simon Guest

  16. #15

    Default Re: Include file

    Simon wrote on 24 okt 2003 in microsoft.public.inetserver.asp.general:
    > I would like to know, how is this in asp.net [..]
    > Can someone explain me how this is practice in asp.net?
    As this is a classical ASP NG,

    please ask a dotnet group.

    It's overthere! [sorry William] ;-)

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan. Guest

  17. #16

    Default Re: Include file

    hi,

    do you know the addres of asp net group?
    I didn't find any. I only found microsoft.public.dotnet.general
    which is more for windows applications.

    Thank you,
    Simon

    "Evertjan." <exjxw.hannivoort@interxnl.net> wrote in message
    news:Xns941E6458138C9eejj99@194.109.133.29...
    > Simon wrote on 24 okt 2003 in microsoft.public.inetserver.asp.general:
    > > I would like to know, how is this in asp.net [..]
    > > Can someone explain me how this is practice in asp.net?
    >
    > As this is a classical ASP NG,
    >
    > please ask a dotnet group.
    >
    > It's overthere! [sorry William] ;-)
    >
    > --
    > Evertjan.
    > The Netherlands.
    > (Please change the x'es to dots in my emailaddress)

    Simon Guest

  18. #17

    Default Re: Include file

    Simon wrote on 24 okt 2003 in microsoft.public.inetserver.asp.general:
    > "Evertjan." <exjxw.hannivoort@interxnl.net> wrote in message
    > news:Xns941E6458138C9eejj99@194.109.133.29...
    >> Simon wrote on 24 okt 2003 in microsoft.public.inetserver.asp.general:
    >> > I would like to know, how is this in asp.net [..]
    >> > Can someone explain me how this is practice in asp.net?
    >>
    >> As this is a classical ASP NG,
    >>
    >> please ask a dotnet group.
    >>
    > do you know the addres of asp net group?
    > I didn't find any. I only found microsoft.public.dotnet.general
    > which is more for windows applications.
    [Please do not toppost on usenet]

    microsoft.public.dotnet.framework.aspnet

    and others

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan. Guest

  19. #18

    Default include file

    Dumb question, but how do you use an include file from another foler on the
    web? like using a forminfo.asp where that file exist in a forms folder>
    <!--#INCLUDE FILE="Forum/default.asp
    "-->
    doesnt work.. <!--#INCLUDE FILE="../Forum/default.asp
    "-->
    doesnt work <!--#INCLUDE FILE="http://myweb.com/Forum/default.asp
    "-->
    doesnt work. any suggestions?
    Thanks
    Jeff


    +FarmerPickles Guest

  20. #19

    Default Re: include file

    <!--#INCLUDE VIRTUAL="..\Forum\default.asp"-->


    --
    FF
    [url]www.francofigun.com.ar[/url]
    [url]www.microsofties.com.ar[/url]
    MSN: [email]francofigun@hotmail.com[/email]
    UIN: 305336919
    Yahoo MSN: [email]frankofm@yahoo.com.ar[/email]
    "+FarmerPickles" <gig_bam_takemeout_@verizon.net> escribió en el mensaje
    news:%23lrZNQCUEHA.2940@TK2MSFTNGP09.phx.gbl...
    > Dumb question, but how do you use an include file from another foler on
    the
    > web? like using a forminfo.asp where that file exist in a forms folder>
    > <!--#INCLUDE FILE="Forum/default.asp
    > "-->
    > doesnt work.. <!--#INCLUDE FILE="../Forum/default.asp
    > "-->
    > doesnt work <!--#INCLUDE FILE="http://myweb.com/Forum/default.asp
    > "-->
    > doesnt work. any suggestions?
    > Thanks
    > Jeff
    >
    >

    Franco Figun Guest

  21. #20

    Default Re: include file

    thanks a bunch!!


    "Franco Figun" <franfig@fibertel.com.ar> wrote in message
    news:%23J5GTcCUEHA.3420@TK2MSFTNGP09.phx.gbl...
    > <!--#INCLUDE VIRTUAL="..\Forum\default.asp"-->
    >
    >
    > --
    > FF
    > [url]www.francofigun.com.ar[/url]
    > [url]www.microsofties.com.ar[/url]
    > MSN: [email]francofigun@hotmail.com[/email]
    > UIN: 305336919
    > Yahoo MSN: [email]frankofm@yahoo.com.ar[/email]
    > "+FarmerPickles" <gig_bam_takemeout_@verizon.net> escribió en el mensaje
    > news:%23lrZNQCUEHA.2940@TK2MSFTNGP09.phx.gbl...
    > > Dumb question, but how do you use an include file from another foler on
    > the
    > > web? like using a forminfo.asp where that file exist in a forms folder>
    > > <!--#INCLUDE FILE="Forum/default.asp
    > > "-->
    > > doesnt work.. <!--#INCLUDE FILE="../Forum/default.asp
    > > "-->
    > > doesnt work <!--#INCLUDE FILE="http://myweb.com/Forum/default.asp
    > > "-->
    > > doesnt work. any suggestions?
    > > Thanks
    > > Jeff
    > >
    > >
    >
    >

    +FarmerPickles Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139