469,356 Members | 1,994 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,356 developers. It's quick & easy.

write <% and %> to file in asp

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\i nfolink.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.
--
Mark
Jul 19 '05 #1
9 4061
Add a second % sign in both lines.

Mike Ober.

"Mark" <mm***@hotmaill.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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\i nfolink.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.
--
Mark

Jul 19 '05 #2
Even better.

Cheers!

Anthony Sullivan

"Michael D. Ober" <obermd-@-alum-mit-edu-nospam> wrote in message
news:8i****************@news.uswest.net...
Add a second % sign in both lines.

Mike Ober.

"Mark" <mm***@hotmaill.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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\i nfolink.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.
--
Mark


Jul 19 '05 #3
Give this a try Mark...

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

Cheers!

Anthony Sullivan

"Mark" <mm***@hotmaill.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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\i nfolink.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.
--
Mark

Jul 19 '05 #4
> tfile.WriteLine("<%")

tfile.writeline "<" & "%"

Jul 19 '05 #5
Thanks All
Mark


"Mark" <mm***@hotmaill.com> wrote in message
news:#L**************@tk2msftngp13.phx.gbl...
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\i nfolink.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.
--
Mark

Jul 19 '05 #6
> took a long time to process and still not working.

Maybe you could tell us what "not working" means...
Jul 19 '05 #7
The file is not produced. I type http://localhost/createfile.asp in address
bar, and the status bar doesn't move but sounds like IIS engine is trying to
process the file but failed.

"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:uL**************@TK2MSFTNGP09.phx.gbl...
took a long time to process and still not working.


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

Jul 19 '05 #8
<<<<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

"John Davis" <jr*******@hotmail.com> wrote in message
news:uT**************@tk2msftngp13.phx.gbl...
The file is not produced. I type http://localhost/createfile.asp in address bar, and the status bar doesn't move but sounds like IIS engine is trying to process the file but failed.

"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:uL**************@TK2MSFTNGP09.phx.gbl...
took a long time to process and still not working.


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


Jul 19 '05 #9
Why do you think it's a syntax issue? Do you have the Norton Virus?
http://www.aspfaq.com/2180


"John Davis" <jr*******@hotmail.com> wrote in message
news:uT**************@tk2msftngp13.phx.gbl...
The file is not produced. I type http://localhost/createfile.asp in address bar, and the status bar doesn't move but sounds like IIS engine is trying to process the file but failed.

"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:uL**************@TK2MSFTNGP09.phx.gbl...
took a long time to process and still not working.


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


Jul 19 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by matatu | last post: by
2 posts views Thread by Donald Firesmith | last post: by
11 posts views Thread by Les Paul | last post: by
2 posts views Thread by jason hirst | last post: by
11 posts views Thread by Michael Powe | last post: by
3 posts views Thread by Manish Sawjiani | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.