Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Executing asp 2

Status
Not open for further replies.

transparent

Programmer
Sep 15, 2001
333
0
0
GB
I have a string whic contains asp and html.

if I response.write this string to the screen it doesn't execute the asp.

How do I get round this?
 
can you post the code You cannot mandate productivity, you must provide the tools to let people become their best.
-Steve Jobs
admin@onpntwebdesigns.com
 
ie

str_HTML = &quot;<img='<%=str_filename%>'>&quot;

response.write str_HTML

This doesn't execute the asp <%=str_filename%>

it just prints:

&quot;<img='<%=str_filename%>'>

How can you get round this problem?

Cheers
 
Try concatenation operator instead of = (or response.write)
str_HTML = &quot;<img='&quot; & str_filename & &quot;'>&quot;
response.write str_HTML
 
also don't forget the src in your img tag
str_HTML = &quot;<img src='&quot; & str_filename & &quot;'>&quot;
response.write str_HTML You cannot mandate productivity, you must provide the tools to let people become their best.
-Steve Jobs
admin@onpntwebdesigns.com
 
It has to be imbedded ie

I'm loading a page (which is an asp page) into a string using the fso object.

I then need to execute the asp inbedded in this string.

It will be of the format

str_html = &quot;<b><%=asp code%></b>&quot;

cheers
 
I got your question.
As far as I know you cannot do this due to security reasons.
May be I'm wrong.
I would suggest to rethink your task and use another approach - may be putting what you need in function in file 1.asp and the use directive #include in 2.asp and use the function you need there.
Hope this helps.
 
dianal is right, you can't do this. Your ASP will execute once at the server side, not twice. Try includes, since they have bigger priority than ASP pages. So include works first, then ASP code, then HTML.

Oh, I just remember a workaround in some cases I needed. After you read your asp file, just before send it to any output use a replace. i.e. response.write replace(html_output,&quot;<%=my_var%>&quot;,my_var).
 
no no no ..
see my comments in the thread titled

how to run asp code from another asp page codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
You're not a complete programmer unless you know how to guess.
I hope I never consider myself an 'expert'.
<insert witticism here>
 
eval() function evaluates vanillia VB script expressions, not the whole ASP page. It will give syntax error even if you try to evaluate &quot;respose.write&quot;
 
eval() function evaluates vanillia VB script expressions, not the whole ASP page. It will give syntax error even if you try to evaluate &quot;response.write&quot;
 
sorry was commenting from memory .. its the execute function in vbscript ..

the below example works

<html>
<body>
<%
dim str_asp
str_asp = &quot;dim lng_count&quot; & vbcrlf & _
&quot;for lng_count = 1 to 10&quot; & vbcrlf & _
&quot;response.write lng_count & &quot;&quot;<br>&quot;&quot;&quot; & vbcrlf & _
&quot;next&quot;
execute str_asp
Response.write &quot;Done.&quot;
%>
</body>
</html> codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
You're not a complete programmer unless you know how to guess.
I hope I never consider myself an 'expert'.
<insert witticism here>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top