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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RECOMPILE ??

Status
Not open for further replies.

svagelis

Programmer
May 2, 2001
121
GR
I'm calling ReadDisplayFile from within my ASP page in order to read another page and include it to the page.
It works just fine when i want to include a static HTML page. When i m calling ASP naturally it just puts the contents of ASP there without Compiling it.
Well this makes sense because this script was produced when it compiled the ReadDisplayFile.
A solution would be to SAY something RECOMPILE tempSTR
Where tempSTR is the code of the included Page


SUB ReadDisplayFile(FileToRead)
whichfile=server.mappath(FileToRead)
Set fs = CreateObject("Scripting.FileSystemObject")
Set thisfile = fs.OpenTextFile(whichfile, 1, False)
tempSTR=thisfile.readall
response.write tempSTR
thisfile.Close
set thisfile=nothing
set fs=nothing
END SUB
 
Firstly, ASP is an interpreted language, not a compiled language.
Secondly, the reason that it is showing your file as plain text is because you are telling it to read a file and display the contents, just like typing
Code:
Response.Write &quot;<%=myVar%>&quot;
would output
Code:
<%=myVar%>
to your html page instead of the value of myVar. If you want the contents to execute as ASP than you should use an include statement rather than a fileread.
Since you need this to be dynamic, an include won't work, so it may be better for you to a Server.Execute command or something similar.

-Tarwn --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
For my next trick I will pull a hat out of a rabbit (if you think thats bad you should see how the pigeon feels...) :p
 
change this

response.write tempSTR

to this

execute tempSTR

This will make the asp code execute
Saturday 12.00
im6.gif
im2.gif
im2.gif
20.00
im5.gif
im4.gif
im7.gif
3.00am
im8.gif
Sunday [img http
 
Thanks GaryC123 but what happens if i have html code + asp Code in my tempSTR ?
Well i guess i could detect HTML AND ASP in tempSTR and execute response.write for HTML code and Server.Execute for ASP code.
Can i avoid this? Can it be done by the server. I mean as it happens when i m opening a HTML+ASP page?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top