Writing out VBS code with response.write() 
Author Message
 Writing out VBS code with response.write()

I have a list of VBS include files in a database field and want to programatically include them into an asp page like so:
<pre>
<%
objrecordset.source="SELECT * FROM plugins WHERE 1=1"
objrecordset.open

while not objrecordset.EOF
if objrecordset.fields("pluginInclude")<>"" then response.write("<%<!--include file=""" & objrecordset.fields("pluginInclude") & """-->%>")
objrecordset.movenext
wend
objrecordset.close
 </pre>

This however doesn''t work, as it''s writing the <!--#include file="xyu.inc"--> line to the HTML..  How else can I do this?

-----------------------------
This message is posted by http://www.*-*-*.com/



Fri, 23 Jul 2004 22:38:02 GMT  
 Writing out VBS code with response.write()
I think the include statements are processed by the
server before anything else even before the asp code.
Response.Write is doing just what you said - writing
the string out to the browser.  Your code would probably
need to create a file that has the includes (and everything else)
in it then at the end do a Response.Redirect or Server.Transfer
to the newly created page.

http://msdn.microsoft.com/library/en-us/iisref/html/psdk/asp/serv9i5h...
ame=true

gl,
Bill Wallace


Quote:
> I have a list of VBS include files in a database field and want to

programatically include them into an asp page like so:
Quote:
> <pre>
> <%
> objrecordset.source="SELECT * FROM plugins WHERE 1=1"
> objrecordset.open

> while not objrecordset.EOF
> if objrecordset.fields("pluginInclude")<>"" then

response.write("<%<!--include file=""" &
objrecordset.fields("pluginInclude") & """-->%>")
Quote:
> objrecordset.movenext
> wend
> objrecordset.close
>  </pre>

> This however doesn''t work, as it''s writing the <!--#include

file="xyu.inc"--> line to the HTML..  How else can I do this?
Quote:

> -----------------------------
> This message is posted by http://asp.forumszone.com



Sat, 24 Jul 2004 00:58:22 GMT  
 Writing out VBS code with response.write()
As stated in another reply, include files are processed before any others
and you cannot do includes like what you are suggesting or conditional
includes.  If you are using Win2000 and IIS5, you do have a way to work
around this built into Active Server Pages.  The way that Microsoft has
provided to do what you are asking about is the Execute method of the Server
object.  The Execute method transfers control to the specified script and
then returns to the current script after running the code in the other
script.  With this method, your code would look like this:

Do Until objrecordset.EOF
    If objrecordset.Fields("pluginInclude") <> "" Then
Server.Execute(objrecordset.Fields("pluginInclude")
    objrecordset.MoveNext
Loop

--

=========================
Kyle M. Burns, MCSD, MCT


Quote:
> I have a list of VBS include files in a database field and want to

programatically include them into an asp page like so:
Quote:
> <pre>
> <%
> objrecordset.source="SELECT * FROM plugins WHERE 1=1"
> objrecordset.open

> while not objrecordset.EOF
> if objrecordset.fields("pluginInclude")<>"" then

response.write("<%<!--include file=""" &
objrecordset.fields("pluginInclude") & """-->%>")
Quote:
> objrecordset.movenext
> wend
> objrecordset.close
>  </pre>

> This however doesn''t work, as it''s writing the <!--#include

file="xyu.inc"--> line to the HTML..  How else can I do this?
Quote:

> -----------------------------
> This message is posted by http://asp.forumszone.com



Sat, 24 Jul 2004 10:21:01 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. writing out double quotes in Response.Write

2. writing quotes with response.write

3. Writing a VBS file which reads and writes to the registry

4. Popup with responses written in code

5. asp response.write in asp.net

6. Response.Write compilation error

7. Response.write - View query with parameters

8. response.write question

9. Examples of using XSLTransform with Response.Write?

10. newby response.write question

11. Response Write and HyperLink

12. Trouble with Response.Write 'ing javascript event handlers

 

 
Powered by phpBB® Forum Software