Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > response.writing an include tag...not working?

Reply
Thread Tools

response.writing an include tag...not working?

 
 
darrel
Guest
Posts: n/a
 
      11-03-2004
I'm trying to load an include dynamically. So, I'm writing out the include
tag via a response.write:

response.write("<!--#include virtual='" & contentIncludeFile &"' -->")

however, that's writing out the include tag AFTER the page is processed,
obviously. Any suggestions for a way around this? Should I instead load the
contents of the include file as a string and then write that out?

-Darrel


 
Reply With Quote
 
 
 
 
=?Utf-8?B?UGF0cmljay5PLklnZQ==?=
Guest
Posts: n/a
 
      11-04-2004
Can u try <%= %> and see but not sure!


"darrel" wrote:

> I'm trying to load an include dynamically. So, I'm writing out the include
> tag via a response.write:
>
> response.write("<!--#include virtual='" & contentIncludeFile &"' -->")
>
> however, that's writing out the include tag AFTER the page is processed,
> obviously. Any suggestions for a way around this? Should I instead load the
> contents of the include file as a string and then write that out?
>
> -Darrel
>
>
>

 
Reply With Quote
 
 
 
 
Scott M.
Guest
Posts: n/a
 
      11-04-2004
Include directives are processed BEFORE any other server-side code and
because of this, you can't do what you are trying because the variable
"contentIncludeFile" hasn't been resolved yet.

This is not a .NET issue/question. It is how the server-side INCLUDE
directive is handled by the server.

Why not ditch "Response.Write" statements as well as INCLUDE directives and
start using .NET techniques such as labels (instead of response.write) and
User Controls (instead of SSI's)?




"darrel" <> wrote in message
news:...
> I'm trying to load an include dynamically. So, I'm writing out the include
> tag via a response.write:
>
> response.write("<!--#include virtual='" & contentIncludeFile &"' -->")
>
> however, that's writing out the include tag AFTER the page is processed,
> obviously. Any suggestions for a way around this? Should I instead load
> the
> contents of the include file as a string and then write that out?
>
> -Darrel
>
>



 
Reply With Quote
 
Darrel
Guest
Posts: n/a
 
      11-04-2004
> Why not ditch "Response.Write" statements as well as INCLUDE directives
> and start using .NET techniques such as labels (instead of response.write)
> and User Controls (instead of SSI's)?


Because sometimes all you need is a response.write and an SSI. ;o)

I like .net, but really, I shouldn' have to use a UC just to include some
text.I find .net a huge improvement, but there's a lot of overkill at the
basic level.

In the end, I've got it working by opening the file, reading it into a
string, and sending the string back to the page. It works fine, but seems a
lot more complicated than a simple old include file ;o)

-Darrel


 
Reply With Quote
 
Guadala Harry
Guest
Posts: n/a
 
      11-04-2004
<<I shouldn' have to use a UC just to include some text.>>

Agreed, and you don't have to. Check out the Literal control. You just need
to set its Text property. The only thing that will show up on the rendered
page is the string you set for it (and in the location on the page in which
you have located the Literal control at design time).

-GH


"Darrel" <> wrote in message
news:...
> > Why not ditch "Response.Write" statements as well as INCLUDE directives
> > and start using .NET techniques such as labels (instead of

response.write)
> > and User Controls (instead of SSI's)?

>
> Because sometimes all you need is a response.write and an SSI. ;o)
>
> I like .net, but really, I shouldn' have to use a UC just to include some
> text.I find .net a huge improvement, but there's a lot of overkill at the
> basic level.
>
> In the end, I've got it working by opening the file, reading it into a
> string, and sending the string back to the page. It works fine, but seems

a
> lot more complicated than a simple old include file ;o)
>
> -Darrel
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/* #include <someyhing.h> */ => include it or do not include it?That is the question .... Andreas Bogenberger C Programming 3 02-22-2008 10:53 AM
#include headers that include this header Aguilar, James C++ 2 07-16-2004 05:56 PM
Re: the use of #include <a_file.h> v/s #include"a_file.cpp" Elie Nader C++ 1 11-28-2003 03:12 PM
Re: the use of #include <a_file.h> v/s #include"a_file.cpp" Rolf Magnus C++ 2 11-28-2003 12:26 PM
#include "bar" negates #include <string> ; how to fix? Danny Anderson C++ 5 08-15-2003 06:38 PM



Advertisments