write <% and %> to file in asp

M

Mark

Hi,
I try to create a file, but failure.
My code like is:

<%
dim fs
dim tfile
strNum = """1005"""
strInfolink = "snum = " & strSiteNum

set fs=Server.CreateObject("Scripting.FileSystemObject")
set tfile=fs.CreateTextFile("D:\Inetpub\wwwroot\html\infolink.asp")
tfile.WriteLine("<%")
tfile.WriteLine(strInfolink)
tfile.WriteLine("%>")
tfile.close
set tfile=nothing
set fs=nothing
%>


Microsoft VBScript compilation error '800a0409'

Unterminated string constant

/html/testing.asp, line 28

tfile.WriteLine("
-----------------^



The problem is '<%', if I take this out, everything is fine.
Thanks.
 
A

Anthony Sullivan

Give this a try Mark...

tfile.WriteLine(chr(60) & "%")
tfile.WriteLine(strInfolink)
tfile.WriteLine("%" & chr(62))

Cheers!

Anthony Sullivan
 
A

Aaron Bertrand - MVP

took a long time to process and still not working.

Maybe you could tell us what "not working" means...
 
B

Bob Lehmann

<<<<but sounds like IIS engine is trying to process the file but failed>>>>
So, what exactly does that sound like?

vroooommm, vroooommm, sputter, cough, clunk?

:>)

Bob Lehmann
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top